bitmap

package
v0.0.0-...-719945b Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Unlicense Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmap256

type Bitmap256 [4]uint64

A Bitmap256 is a bitmap of 256 elements.

Using a fixed-size structure avoids the overhead of using a slice (both the 3-word slice structure, and the associated cache-miss due to the slice indirection), at the cost of flexibility.

func (*Bitmap256) Clear

func (v *Bitmap256) Clear(pos uint8)

Set the bit at position pos to false.

func (*Bitmap256) Count

func (v *Bitmap256) Count() int

Return the number of true bits ("population count").

func (*Bitmap256) CountLess

func (v *Bitmap256) CountLess(pos uint8) int

Return the number of true bits up to, but not including, position pos.

func (*Bitmap256) Empty

func (v *Bitmap256) Empty() bool

Return whether all bits are false

func (*Bitmap256) FindFirstClear

func (v *Bitmap256) FindFirstClear() int

Return the position of the first false bit in the bitmap, and 256 if there are no false bits.

func (*Bitmap256) FindFirstSet

func (v *Bitmap256) FindFirstSet() int

Return the position of the first true bit in the bitmap, and 256 if there are no true bits.

func (*Bitmap256) FindNextClear

func (v *Bitmap256) FindNextClear(pos uint8) int

Return the position of the first false bit starting at position pos, and 256 if there are no further false bits.

func (*Bitmap256) FindNextSet

func (v *Bitmap256) FindNextSet(pos uint8) int

Return the position of the first true bit starting at position pos, and 256 if there are no further true bits.

func (*Bitmap256) FindNthSet

func (v *Bitmap256) FindNthSet(n uint8) int

Return the position of the n-th (zero-indexed) true bit in the bitmap, and 256 if there are not true bits. The first true bit is n == 0.

func (*Bitmap256) Full

func (v *Bitmap256) Full() bool

Return whether all bits are true

func (*Bitmap256) Get

func (v *Bitmap256) Get(pos uint8) bool

Return the bit value at position pos.

func (*Bitmap256) Set

func (v *Bitmap256) Set(pos uint8)

Set the bit at position pos to true.

Jump to

Keyboard shortcuts

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