Documentation
¶
Overview ¶
Package bitset implements a Bitset and a small Bits.
Index ¶
- Constants
- func BitCount(n uint64) int
- func BitCountUint(x uint) int
- type Bits
- func (s *Bits) BitCount() int
- func (s *Bits) Flip(index uint)
- func (s *Bits) FlipAll()
- func (s *Bits) IsSet(index uint) bool
- func (s *Bits) Set(index uint)
- func (s *Bits) SetAll()
- func (s *Bits) SetBefore(index uint)
- func (s *Bits) SetSince(index uint)
- func (s *Bits) SetTo(index uint, val bool)
- func (s *Bits) Uint() uint
- func (s *Bits) Uint64() uint64
- func (s *Bits) Unset(index uint)
- func (s *Bits) UnsetAll()
- func (s *Bits) UnsetBefore(index uint)
- func (s *Bits) UnsetSince(index uint)
- type Bitset
- func (s *Bitset) BitCount() int
- func (s *Bitset) Bits() []uint
- func (s *Bitset) Clone() *Bitset
- func (s *Bitset) Diff(b *Bitset) *Bitset
- func (s *Bitset) Except(index ...uint) *Bitset
- func (s *Bitset) Flip(index uint) *Bitset
- func (s *Bitset) FlipAll() *Bitset
- func (s *Bitset) Intersection(b *Bitset) *Bitset
- func (s *Bitset) IsSet(index uint) bool
- func (s *Bitset) Length(l uint) uint
- func (s *Bitset) Set(index uint) *Bitset
- func (s *Bitset) SetAll() *Bitset
- func (s *Bitset) SetTo(index uint, value bool) *Bitset
- func (s *Bitset) Uint() uint
- func (s *Bitset) Uint64() uint64
- func (s *Bitset) Union(b *Bitset) *Bitset
- func (s *Bitset) UnitCount() uint
- func (s *Bitset) UnitLen() uint
- func (s *Bitset) Unset(index uint) *Bitset
- func (s *Bitset) UnsetAll() *Bitset
Constants ¶
View Source
const (
Uint0 uint = 0
)
u_1 is uint 1
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bits ¶
type Bits uint64
Bits is a lightweight bitset implementation based on a uint64 number, it's not safety for concurrent.
func (*Bits) UnsetBefore ¶
UnsetBefore set all bits before index to 0, index bit is not included
func (*Bits) UnsetSince ¶
UnsetSince set all bits since index to 0, index bit is include
type Bitset ¶
type Bitset struct {
// contains filtered or unexported fields
}
Bitset is a bitset based on a uint64 array
func (*Bitset) Intersection ¶
Intersection another bitset to current bitset
func (*Bitset) Length ¶
Length change the bitset's length, if zero, only return current length.
Only when new length is larger or half less than now, the allocation will occurred
func (*Bitset) Union ¶
Union union another bitset to current bitset, expand the bitset if index out of length range
Click to show internal directories.
Click to hide internal directories.