bitvector

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitVector

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

BitVector is a convenience object for manipulating and representing bit vectors

func New

func New(l int) (bv *BitVector, err error)

New creates a new bit vector with the given length

func NewFromBytes

func NewFromBytes(b []byte, l int) (bv *BitVector, err error)

NewFromBytes creates a bit vector from the passed byte slice.

Leftmost bit in byte slice becomes leftmost bit in bit vector

func (*BitVector) Bytes

func (bv *BitVector) Bytes() []byte

Bytes retrieves the underlying bytes of the bitvector

func (*BitVector) Get

func (bv *BitVector) Get(i int) bool

Get gets the corresponding bit, counted from left to right

func (*BitVector) Set

func (bv *BitVector) Set(i int)

Set sets the bit corresponding to the index in the bitvector, counted from left to right

func (*BitVector) SetBytes added in v0.4.3

func (bv *BitVector) SetBytes(bs []byte) error

SetBytes sets all bits in the bitvector that are set in the argument

The argument must be the same as the bitvector length

func (*BitVector) String added in v0.4.3

func (bv *BitVector) String() (s string)

String implements Stringer interface

func (*BitVector) Unset added in v0.4.3

func (bv *BitVector) Unset(i int)

Unset UNSETS the corresponding bit, counted from left to right

func (*BitVector) UnsetBytes added in v0.4.3

func (bv *BitVector) UnsetBytes(bs []byte) error

UnsetBytes UNSETS all bits in the bitvector that are set in the argument

The argument must be the same as the bitvector length

Jump to

Keyboard shortcuts

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