bitarray

package
v0.0.0-...-b1a1f83 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitArray

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

Struct to simplify appending bits to a byte array, from left to right

func NewBitArray

func NewBitArray(numBits int) (*BitArray, error)

*

  • Constructor for the BitArray struct. It must be initialized
  • with a non-zero int that is a multiple of 8.
  • Usage:
  • bitArray,err := bitops.NewBitArray(64) *
  • @method NewBitArray
  • @param {int} numBits The number of bits, as an int
  • @return {BitArray} The AppendBit struct
  • @return {error} If there is an error

func (*BitArray) AppendBit

func (ab *BitArray) AppendBit(bit int) error

*

  • Append a bit to the byte array from left to right
  • @method appendBit
  • @param {int} bit Append a one with '1', and zero with '0'

func (BitArray) GetArray

func (ab BitArray) GetArray() []byte

*

  • Returns the current byte array
  • @method getArray
  • @return {[]byte]} The byte array

Jump to

Keyboard shortcuts

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