bitvector

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: BSD-3-Clause Imports: 1 Imported by: 1

Documentation

Overview

Package bitvector provides functionality of a simple bit vector implementation.

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) (*BitVector, error)

New creates a new bit vector with the given length

func NewFromBytes

func NewFromBytes(b []byte, l int) (*BitVector, 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

Jump to

Keyboard shortcuts

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