bitmap

package
v28.5.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package bitmap provides a datatype for long vectors of bits.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoBitAvailable is returned when no more bits are available to set
	ErrNoBitAvailable = errors.New("no bit available")
	// ErrBitAllocated is returned when the specific bit requested is already set
	ErrBitAllocated = errors.New("requested bit is already allocated")
)

Functions

This section is empty.

Types

type Bitmap

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

Bitmap is a fixed-length bit vector. It is not safe for concurrent use.

The data is stored as a list of run-length encoded blocks. It operates directly on the encoded representation, without decompressing.

func Copy

func Copy(b *Bitmap) *Bitmap

Copy returns a deep copy of b.

func New

func New(n uint64) *Bitmap

New returns a new Bitmap of ordinals in the interval [0, n).

func (*Bitmap) Bits

func (h *Bitmap) Bits() uint64

Bits returns the length of the bit sequence

func (*Bitmap) IsSet

func (h *Bitmap) IsSet(ordinal uint64) bool

IsSet atomically checks if the ordinal bit is set. In case ordinal is outside of the bit sequence limits, false is returned.

func (*Bitmap) MarshalBinary

func (h *