Documentation ¶
Overview ¶
Package bitmap provides functions for working with bitmaps stored as byte slices of arbitrary size
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clear ¶
Clear clears a bit inside a given byte slice
Example ¶
package main import ( "fmt" "github.com/anexia-it/bitmap" ) func main() { m := []byte{0x80 | 0x40, 0x00, 0x00, 0x01} bitmap.Clear(m, 31) fmt.Printf("%x\n", m) }
Output: 40000001
func IsSet ¶
IsSet checks if a bit is set inside a given byte slice
Example ¶
package main import ( "fmt" "github.com/anexia-it/bitmap" ) func main() { m := []byte{0xf0, 0x0f} fmt.Printf("%t %t %t %t %t %t %t %t %t %t %t %t %t %t %t %t", bitmap.IsSet(m, 0), bitmap.IsSet(m, 1), bitmap.IsSet(m, 2), bitmap.IsSet(m, 3), bitmap.IsSet(m, 4), bitmap.IsSet(m, 5), bitmap.IsSet(m, 6), bitmap.IsSet(m, 7), bitmap.IsSet(m, 8), bitmap.IsSet(m, 9), bitmap.IsSet(m, 10), bitmap.IsSet(m, 11), bitmap.IsSet(m, 12), bitmap.IsSet(m, 13), bitmap.IsSet(m, 14), bitmap.IsSet(m, 15), ) }
Output: true true true true false false false false false false false false true true true true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.