Documentation ¶
Overview ¶
Package bit implements operations on sets of bits.
TODO: use sync.Pool?
Index ¶
- type Set
- type Set256
- func (s *Set256) Add(n uint8)
- func (Set256) Capacity() int
- func (s *Set256) Clear()
- func (s *Set256) Contains(n uint8) bool
- func (s *Set256) Elements(a []uint8, start uint8) int
- func (s *Set256) Elements64(a []uint64, start uint8, high uint64) int
- func (s *Set256) Empty() bool
- func (s1 *Set256) Equal(s2 *Set256) bool
- func (c *Set256) IntersectN(bs []*Set256)
- func (b *Set256) Position(n uint8) (int, bool)
- func (s *Set256) Remove(n uint8)
- func (s *Set256) Size() int
- func (s Set256) String() string
- type Set64
- func (s *Set64) Add(u uint8)
- func (Set64) Capacity() int
- func (s *Set64) Clear()
- func (s *Set64) Contains(u uint8) bool
- func (s Set64) Elements(a []uint8, start uint8) int
- func (s Set64) Elements64(a []uint64, start uint8, high uint64) int
- func (s Set64) Empty() bool
- func (s1 *Set64) IntersectWith(s2 Set64)
- func (s Set64) Position(n uint8) (int, bool)
- func (s *Set64) Remove(u uint8)
- func (s Set64) Size() int
- func (s Set64) String() string
- func (s1 *Set64) UnionWith(s2 Set64)
- type SparseSet
- func (s *SparseSet) Add(n uint64)
- func (s *SparseSet) Clear()
- func (s *SparseSet) Contains(n uint64) bool
- func (s *SparseSet) Elements(a []uint64, start uint64) int
- func (s *SparseSet) Empty() bool
- func (s1 *SparseSet) Equal(s2 *SparseSet) bool
- func (s *SparseSet) Intersect(ss ...*SparseSet)
- func (s *SparseSet) MemSize() uint64
- func (s *SparseSet) Remove(n uint64)
- func (s *SparseSet) Size() int
- func (s SparseSet) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is a standard bitset, represented "densely"; in other words, using one bit per element. See SparseSet in this package for a more compact storage scheme for sparse bitsets.
func NewSet ¶
NewSet creates a set capable of representing values in the range [0, capacity), at least. It may allow values greater than capacity-1. Call the Capacity method to find out. NewSet panics if capacity is negative.
func (*Set) ChangeCapacity ¶
func (*Set) IntersectWith ¶
type Set256 ¶
type Set256 struct {
// contains filtered or unexported fields
}
A Set256 represents a set of integers in the range [0, 256). It does so more efficiently than a Set of capacity 256. For efficiency, the methods of Set256 perform no bounds checking on their arguments.
type Set64 ¶
type Set64 uint64
Set64 is an efficient representation of a bitset that can represent integers in the range [0, 64). For efficiency, the methods of Set64 perform no bounds checking on their arguments.
func (Set64) Elements64 ¶
TODO: why exported?