bitset

package
v0.0.0-...-10b1222 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const MaxBitsetWords = 16

MaxBitsetWords specifies the number of 64-bit words in the bitset.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitsTraverser

type BitsTraverser struct {
	// contains filtered or unexported fields
}

BitsTraverser is an iterator that allows to iterate over all bits set in the given 64-bit unsigned integer.

Iteration is performed from the least significant bit to the most significant one.

func NewBitsTraverser

func NewBitsTraverser(word uint64) BitsTraverser

NewBitsTraverser constructs a new bits traverser over given 64-bit word.

func (BitsTraverser) Iter

func (m BitsTraverser) Iter() iter.Seq[uint32]

Iter returns an iterator over the bits set in this word.

func (BitsTraverser) Traverse

func (m BitsTraverser) Traverse(fn func(uint32) bool) bool

Traverse traverses the bitset and calls the given function for each bit set.

type TinyBitset

type TinyBitset struct {
	// contains filtered or unexported fields
}

TinyBitset implements constant-length bitset.

This structure is designed to be used as a comparable key in maps.

func (*TinyBitset) AsSlice

func (m *TinyBitset) AsSlice() []uint32

AsSlice returns the bitset as a slice of indices, where each index is a position of the bit set.

func (*TinyBitset) Count

func (m *TinyBitset) Count() uint

Count returns the number of bits set in the bitset.

func (*TinyBitset) Insert

func (m *TinyBitset) Insert(idx uint32)

Insert inserts the given index into the bitset.

func (*TinyBitset) Iter

func (m *TinyBitset) Iter() iter.Seq[uint32]

func (*TinyBitset) Traverse

func (m *TinyBitset) Traverse(fn func(uint32) bool)

Traverse traverses the bitset and calls the given function for each bit set.

Iteration is performed from the least significant bit to the most significant one.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL