Documentation ¶
Overview ¶
Package bitset implements getting and setting of true/false values within bytes.
Index ¶
Constants ¶
const (
WIDTH = 8
)
According to the Go spec, byte = uint8, so we set our byte width to 8 here
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitSet ¶
type BitSet struct {
// contains filtered or unexported fields
}
BitSet is simply an array of bytes large enough to contain the number of bits the user requests. Values are encoded in a little endian fashion: in a single bytes, bits would be indexes as 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0. Callers need not concern themselves with this implementation detail: getting, setting and unsetting bits is done through functions.
func (*BitSet) DumpBitSet ¶
DumpBitSet will return a string form of the BitSet.
func (*BitSet) GetBitN ¶
GetBitN will read bit n as either true (1) or false (0). Error if n is not indexable in this BitSet.