binutil

package
v2.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDiscreteStatuses added in v2.4.0

func GetDiscreteStatuses[T constraints.Integer](s T, max T) []T

GetDiscreteStatuses in a slice of valid statuses from the given T value

func PrintN

func PrintN(n, size uint)

PrintN prints the size number bits in the passed uint from MSb to LSb

Types

type BitVector

type BitVector []bits

BitVector is a convenience structure for setting inividual bits in an array of bytes. Create a new BitVector using 'new(BitVector)'. The BitVector will be automatically sized to accomadate the positions passed in, however you preallocate space by calling SizeForPosition with the highest bit position required.

func NewBitVector

func NewBitVector(b []byte) BitVector

NewBitVector from the passed bytes.

func (*BitVector) Bytes

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

Bytes of the BitVector

func (*BitVector) Print

func (bv *BitVector) Print()

Print the bit vector LSB to MSB and MSb to LSb within bytes.

func (*BitVector) PrintHex

func (bv *BitVector) PrintHex()

PrintHex prints the bytes in order (0->N) in their Hexadecimal representation.

func (*BitVector) Set

func (bv *BitVector) Set(position uint)

Set the position passed to 1 in the BitVector

func (*BitVector) SetN

func (bv *BitVector) SetN(value, n, start uint)

SetN sets the bits in the BitVector to the same values as the 'n' bits in the passed uint starting at the specified place.

func (*BitVector) SizeForPosition

func (bv *BitVector) SizeForPosition(position uint)

SizeForPosition resizes the BitVector to accomodate the position passed.

func (*BitVector) UnSet

func (bv *BitVector) UnSet(position uint)

UnSet the position passed in the BitVector. (Sets the position to 0.)

func (*BitVector) Value

func (bv *BitVector) Value(position uint) int

Value of the position (0||1) This function will resize the underlying BitVector if the position is outside of the current bounds.

func (*BitVector) ValueN

func (bv *BitVector) ValueN(n, start uint) uint

ValueN gets the value of the first 'n' bits starts at the specified location and returns the result as a uint.

Jump to

Keyboard shortcuts

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