bitmap

package
v0.0.0-...-8940ca0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package bitmap provides the implementation of bitmap.

Index

Constants

View Source
const MaxBitEntryLimit uint32 = math.MaxInt32

MaxBitEntryLimit defines the upper limit on how many bit entries are supported by this Bitmap implementation.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmap

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

Bitmap implements an efficient bitmap.

+stateify savable

func New

func New(size uint32) Bitmap

New create a new empty Bitmap.

func (*Bitmap) Add

func (b *Bitmap) Add(i uint32)

Add add i to the Bitmap.

func (*Bitmap) ClearRange

func (b *Bitmap) ClearRange(begin, end uint32)

ClearRange clear bits within range (begin and end) for the Bitmap. begin is inclusive and end is exclusive.

func (*Bitmap) Clone

func (b *Bitmap) Clone() Bitmap

Clone the Bitmap.

func (*Bitmap) FirstOne

func (b *Bitmap) FirstOne(start uint32) (bit uint32, err error)

FirstOne returns the first set bit from the range [start, )

func (*Bitmap) FirstZero

func (b *Bitmap) FirstZero(start uint32) (bit uint32, err error)

FirstZero returns the first unset bit from the range [start, ).

func (*Bitmap) FlipRange

func (b *Bitmap) FlipRange(begin, end uint32)

FlipRange flip bits within range (begin and end) for the Bitmap. begin is inclusive and end is exclusive.

func (*Bitmap) GetNumOnes

func (b *Bitmap) GetNumOnes() uint32

GetNumOnes return the the number of ones in the Bitmap.

func (*Bitmap) Grow

func (b *Bitmap) Grow(toGrow uint32) error

Grow grows the bitmap by at least toGrow bits.

func (*Bitmap) IsEmpty

func (b *Bitmap) IsEmpty() bool

IsEmpty verifies whether the Bitmap is empty.

func (*Bitmap) Maximum

func (b *Bitmap) Maximum() uint32

Maximum return the largest value in the Bitmap.

func (*Bitmap) Minimum

func (b *Bitmap) Minimum() uint32

Minimum return the smallest value in the Bitmap.

func (*Bitmap) Remove

func (b *Bitmap) Remove(i uint32)

Remove i from the Bitmap.

func (*Bitmap) Size

func (b *Bitmap) Size() int

Size returns the total number of bits in the bitmap.

func (*Bitmap) StateFields

func (b *Bitmap) StateFields() []string

func (*Bitmap) StateLoad

func (b *Bitmap) StateLoad(stateSourceObject state.Source)

+checklocksignore

func (*Bitmap) StateSave

func (b *Bitmap) StateSave(stateSinkObject state.Sink)

+checklocksignore

func (*Bitmap) StateTypeName

func (b *Bitmap) StateTypeName() string

func (*Bitmap) ToSlice

func (b *Bitmap) ToSlice() []uint32

ToSlice transform the Bitmap into slice. For example, a bitmap of [0, 1, 0, 1] will return the slice [1, 3].

Jump to

Keyboard shortcuts

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