datatypes

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitArray

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

BitArray is a fast, memory-efficient implementation of a bit (bool) array. Use the NewBitArray function to create one.

func FromBytes

func FromBytes(src []byte) BitArray

FromBytes creates a new BitArray with the provided bytes as initial values. Beware that the src slice is *NOT* copied, so mutating it will change the inner state of this Array.

func NewBitArray

func NewBitArray(size int) BitArray

NewBitArray creates and returns a new BitArray with the specified size

func (BitArray) Expose

func (b BitArray) Expose() []byte

Expose exposes the underlying byte array. Only use this read-only or you will change the inner state of this struct, which can cause unexpected behavior

func (BitArray) Get

func (b BitArray) Get(index int) bool

Get returns the bit at the specified index. false = 0. true = 1.

func (BitArray) Len

func (b BitArray) Len() int

Len returns the len/size of the array

func (BitArray) Set

func (b BitArray) Set(index int, value bool)

Set allows you the set the bit at the specified index. false = 0. true = 1.

Jump to

Keyboard shortcuts

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