Documentation
¶
Index ¶
- Constants
- type BitSet
- func (b *BitSet) All() iter.Seq[int]
- func (b *BitSet) Clear(bit int)
- func (b *BitSet) Flip()
- func (b *BitSet) FlipRange(start int, end int)
- func (b *BitSet) Get(bit int) bool
- func (b *BitSet) Length() int
- func (b *BitSet) Set(bit int)
- func (b *BitSet) SetBits() iter.Seq[int]
- func (b *BitSet) Size() int
- func (b *BitSet) String() string
- func (b *BitSet) ToBytes() []byte
- func (b *BitSet) UnsetBits() iter.Seq[int]
- type Config
- type Option
Constants ¶
const (
DefaultNumBits = 64
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitSet ¶
type BitSet struct {
// contains filtered or unexported fields
}
BitSet represents a vector of bits that grows as needed.
func New ¶
New creates a BitSet whose initial size is large enough to explicitly represent bits with indices in the range 0 through NumBits-1. If no configuration is used the DefaultNumBits is used as the number of bits. All bits are initially false.
func (*BitSet) Flip ¶
func (b *BitSet) Flip()
Flip sets each bit to the complement of its current value. This call is equivalent to b.FlipRange(0, b.Size())
func (*BitSet) FlipRange ¶
FlipRange sets each bit from the specified start bit (inclusive) to the specified end bit (exclusive) to the complement of its current value.
func (*BitSet) Length ¶
Length returns the 'logical size' of this BitSet. The 'logical size' is the highest set bit in the BitSet plus one. Returns zero if no bits are set.