Documentation
¶
Overview ¶
BitArray for Golang.
Index ¶
- Constants
- type BitArray
- func (bits *BitArray) Clear(low int, high int) error
- func (bits *BitArray) Count() int
- func (bits *BitArray) Eq(obits *BitArray) bool
- func (bits *BitArray) Get(n int) (int, error)
- func (bits *BitArray) Len() int
- func (bits *BitArray) Leq(obits *BitArray) bool
- func (bits *BitArray) Lt(obits *BitArray) bool
- func (bits *BitArray) Not(low int, high int) error
- func (bits *BitArray) Put(n int, bit int) (int, error)
- func (bits *BitArray) Set(low int, high int) error
- func (bits *BitArray) ToArray() []int
Constants ¶
const (
BitsPW int = _BytesPW * 8
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitArray ¶
type BitArray struct {
// contains filtered or unexported fields
}
func (*BitArray) Clear ¶
Clear set the value of all bits to 0, which index range between low and high, both low and high included. low must less than high, and low/high cannot out of range [0, BitArray.Len()).
func (*BitArray) Eq ¶
Eq check whether the BitArray is equal to another BitArray. If length isn't same, return false.
func (*BitArray) Get ¶
Get return the bit by index n. If index out of range [0, BitArray.Len()), return error.
func (*BitArray) Leq ¶
Leq check whether the BitArray is the subset of the another. If length isn't same, return false.
func (*BitArray) Lt ¶
Lt check whether the BitArray is the proper subset of the another. If length isn't same, return false.
func (*BitArray) Not ¶
Not flips the value of all bits, which index range between low and high, both low and high included. low must less than high, and low/high cannot out of range [0, BitArray.Len()).
func (*BitArray) Put ¶
Put set the nth bit with 0/1, and return the old value of nth bit. If index out of range [0, BitArray.Len()), return error.