Documentation ¶
Index ¶
- type Bitset
- func (bs Bitset) And(b2 Bitset) Bitset
- func (bs Bitset) AndNot(b2 Bitset) Bitset
- func (bs Bitset) ForEach(yield func(int))
- func (bs Bitset) IsContainedBy(b2 Bitset) bool
- func (bs Bitset) Or(b2 Bitset) Bitset
- func (bs Bitset) Overlaps(b2 Bitset) bool
- func (bs Bitset) Popcount() (count int)
- func (bs Bitset) Set(offset int) Bitset
- func (bs Bitset) SingleBit() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bitset ¶
type Bitset string
A Bitset is an immutable collection of bits. You can perform logical operations on it, but all mutable operations return a new Bitset. It is safe to compare directly using the comparison operator and to use as a map key.
func Single ¶
Single returns a new Bitset where only the given bit is set. If the given bit is less than 32, Single does not allocate to create a new Bitset.
func (Bitset) ForEach ¶
ForEach calls the given callback with the position of each bit set in this Bitset
func (Bitset) IsContainedBy ¶
IsContainedBy returns whether this Bitset is contained by the given Bitset
Click to show internal directories.
Click to hide internal directories.