bitmap

package
v0.0.0-...-8135c48 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2016 License: MIT, MIT Imports: 2 Imported by: 0

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

View Source
const MaxInt = -1

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmap

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

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

func Sub

func Sub(left, right *Bitmap) *Bitmap

func (*Bitmap) Add

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

func (*Bitmap) AddRange

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

func (*Bitmap) Clear

func (me *Bitmap) Clear()

func (*Bitmap) Contains

func (me *Bitmap) Contains(i int) bool

func (Bitmap) Copy

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

func (*Bitmap) FlipRange

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

func (*Bitmap) Get

func (me *Bitmap) Get(bit int) bool

func (*Bitmap) Iter

func (me *Bitmap) Iter(f func(interface{}) bool)

func (Bitmap) IterTyped

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

func (*Bitmap) Len

func (me *Bitmap) Len() int

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

func (*Bitmap) Remove

func (me *Bitmap) Remove(i int)

func (*Bitmap) RemoveRange

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

func (*Bitmap) Set

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

func (*Bitmap) Sub

func (me *Bitmap) Sub(other *Bitmap)

func (Bitmap) ToSortedSlice

func (me Bitmap) ToSortedSlice() (ret []int)

func (*Bitmap) Union

func (me *Bitmap) Union(other *Bitmap)

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