Documentation ¶
Overview ¶
Package bit provides a Go implementation of bit arrays.
Index ¶
- type Array
- func (a *Array) Add(v int)
- func (a *Array) AddBits(v uint64, n int)
- func (a *Array) Bits() []uint64
- func (a *Array) Clear(n int)
- func (a *Array) Copy() *Array
- func (a *Array) Get(n int) int
- func (a *Array) GetBool(n int) bool
- func (a *Array) Len() int
- func (a *Array) Popcnt() int
- func (a *Array) Reset()
- func (a *Array) Set(n int)
- func (a *Array) SetBit(n, v int)
- func (a *Array) SetBitBool(n int, b bool)
- func (a *Array) String() string
- func (a *Array) Toggle(n int)
- func (a *Array) Uint64() uint64
- func (a *Array) WriteTo(w io.Writer) (n int64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Array ¶
type Array struct {
// contains filtered or unexported fields
}
An Array is a variable-sized array of bits. The zero value for Array is an empty Array ready to use.
func NewArrayFromSlice ¶
NewArrayFromSlice constructs and returns a new bit array from a slice of uint64s.
func (*Array) SetBit ¶
SetBit sets the nth bit to the value of the least significant bit of v, which must be either 0 or 1.
func (*Array) SetBitBool ¶
SetBitBool sets the nth bit to 0 if b is false and to 1 otherwise.
Click to show internal directories.
Click to hide internal directories.