bitvector

package
v0.5.9-0...-ba7202b Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 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

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

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

String implements Stringer interface

func (*BitVector) Unset

func (bv *BitVector) Unset(i int)

Unset UNSETS the corresponding bit, counted from left to right

func (*BitVector) UnsetBytes

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