bitmap

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ctz64

func Ctz64(x uint64) int

Ctz64 counts trailing (low-order) zeroes, and if all are zero, then 64.

func DecodeToUintArray

func DecodeToUintArray(data []byte) []uint64

DecodeToUintArray decodes input bytes to []uint64.

func EncodeUintArray

func EncodeUintArray(input []uint64) []byte

EncodeUintArray encodes []uint64 to bytes.

Types

type BitMap

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

BitMap is a struct which provides the Get or Set of bits map.

func NewBitMap

func NewBitMap(sizeOf64Bits uint32, allSetBit bool) (*BitMap, error)

NewBitMap generates a BitMap.

func NewBitMapWithNumBits added in v1.0.5

func NewBitMapWithNumBits(numberBits uint32, allSetBit bool) (*BitMap, error)

NewBitMapWithNumBits generates a BitMap.

func RestoreBitMap

func RestoreBitMap(data []byte) (*BitMap, error)

RestoreBitMap generate the BitMap by input bytes.

func (*BitMap) Encode

func (b *BitMap) Encode() []byte

func (*BitMap) Get

func (b *BitMap) Get(start uint32, end uint32, setBit bool) ([]*BitsRange, error)

Get gets the bits in range [start, end]. if set is true, return the set bits. else return the unset bits.

func (*BitMap) Set

func (b *BitMap) Set(start uint32, end uint32, setBit bool) error

Set sets or cleans the bits in range [start, end]. if setBit is true, set bits. else clean bits.

type BitsRange

type BitsRange struct {
	StartIndex uint32
	EndIndex   uint32
}

BitsRange shows the range of bitmap.

Jump to

Keyboard shortcuts

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