bitmap

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 2 Imported by: 5

Documentation

Overview

Package bitmap provides a []bool/bitmap implementation with standardized iteration. Bitmaps are the equivalent of []bool, with improved compression for runs of similar values, and faster operations on ranges and the like.

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type BitIndex

type BitIndex = uint32

type BitRange added in v2.5.1

type BitRange = uint64

type Bitmap

type Bitmap struct {
	RB *roaring.Bitmap
}

Bitmaps store the existence of values in [0,math.MaxUint32] more efficiently than []bool. The empty value starts with no bits set.

func Flip

func Flip(bm Bitmap, start, end BitRange) Bitmap

func Sub

func Sub(left, right Bitmap) Bitmap

func (*Bitmap) Add

func (me *Bitmap) Add(is ...BitIndex)

func (*Bitmap) AddRange

func (me *Bitmap) AddRange(begin, end BitRange)

func (*Bitmap) Clear

func (me *Bitmap) Clear()

func (Bitmap) Contains

func (me Bitmap) Contains(i BitIndex) bool

func (Bitmap) Copy

func (me Bitmap) Copy() (ret Bitmap)

func (*Bitmap) FlipRange

func (me *Bitmap) FlipRange(begin, end BitRange)

func (Bitmap) Get

func (me Bitmap) Get(bit BitIndex) bool

func (Bitmap) IsEmpty

func (me Bitmap) IsEmpty() bool

func (Bitmap) Iter

func (me Bitmap) Iter(cb iter.Callback)

func (Bitmap) IterTyped

func (me Bitmap) IterTyped(f func(int) bool) bool

Returns true if all values were traversed without early termination.

func (Bitmap) Len

func (me Bitmap) Len() BitRange

The number of set bits in the bitmap. Also known as cardinality.

func (*Bitmap) Remove

func (me *Bitmap) Remove(i BitIndex) bool

func (*Bitmap) RemoveRange

func (me *Bitmap) RemoveRange(begin, end BitRange) *Bitmap

func (*Bitmap) Set

func (me *Bitmap) Set(bit BitIndex, value bool)

func (*Bitmap) Sub

func (me *Bitmap) Sub(other Bitmap)

func (Bitmap) ToSortedSlice

func (me Bitmap) ToSortedSlice() []BitIndex

func (*Bitmap) Union

func (me *Bitmap) Union(other Bitmap)

type Interface

type Interface interface {
	Len() int
}

type Iter

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

func (*Iter) Next

func (me *Iter) Next() bool

func (*Iter) Stop

func (me *Iter) Stop()

func (*Iter) Value

func (me *Iter) Value() interface{}

func (*Iter) ValueInt

func (me *Iter) ValueInt() int

Jump to

Keyboard shortcuts

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