...
Package bitmask
▾ Example
Code:
i := bitmask.New(0b11111111)
i.Set(0, false)
fmt.Println(i)
i.Set(3, false)
fmt.Println(i)
i.Set(0, true)
fmt.Println(i)
fmt.Println("2:", i.Get(2))
fmt.Printf("[]byte: %b\n", i.Byte())
Output:
11111110
11110110
11110111
2: true
[]byte: [11110111]
type Bitmask struct {
}
func New(init int) *Bitmask
func (*Bitmask) Byte
¶
func (b *Bitmask) Byte() []byte
func (*Bitmask) Get
¶
func (b *Bitmask) Get(pos int) bool
func (*Bitmask) Int
¶
func (b *Bitmask) Int() int
func (*Bitmask) Set
¶
func (b *Bitmask) Set(pos int, val bool) int
func (*Bitmask) String
¶
func (b *Bitmask) String() string