bitvector

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: BSD-3-Clause Imports: 1 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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