bitfield

package
v0.0.0-...-ceb2c1b Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(encoded []byte) ([]byte, error)

func Encode

func Encode(data []byte) ([]byte, bool)

Types

type Bitfield

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

func NewBitfield

func NewBitfield(pageSize int) *Bitfield

func (Bitfield) ByteLength

func (b Bitfield) ByteLength() uint64

ByteLength returns the number of bytes in the bitfield

func (*Bitfield) GetBit

func (b *Bitfield) GetBit(index uint64) bool

GetBit returns the value of the bit at a provided index

func (*Bitfield) GetByte

func (b *Bitfield) GetByte(index uint64) byte

GetByte returns the value of the byte at a provided index

func (Bitfield) IsEmpty

func (b Bitfield) IsEmpty() bool

IsEmpty returns true if no bits are stored in the bitfield

func (Bitfield) Len

func (b Bitfield) Len() uint64

Len returns the number of bits set in the bitfield

func (Bitfield) PageSize

func (b Bitfield) PageSize() int

PageSize returns the size of the pages used by the internal pager

func (*Bitfield) SetBit

func (b *Bitfield) SetBit(index int, value bool) bool

SetBit sets the bit at a particular index within the bitfield Returns true if a change was inacted

func (*Bitfield) SetByte

func (b *Bitfield) SetByte(index uint64, value byte) bool

SetByte sets the byte at a particular index within the bitfield Returns true if a change was inacted

Jump to

Keyboard shortcuts

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