bitarray

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 3 Imported by: 1

README

binarray

BinArray implements an array of bits.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinArray

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

func NewBinArray

func NewBinArray(num int) *BinArray

NewBinArray returns a *BinArray possible to hold num bits.

func (*BinArray) All

func (b *BinArray) All() *BinArray

All returns a bit array with all bits set to 1. It does not change the receiver.

func (*BinArray) And

func (b *BinArray) And(w *BinArray) *BinArray

And performs the and boolean operator on all bits. Also on the ones outside the size area.

func (*BinArray) Clone

func (b *BinArray) Clone() *BinArray

Clone creates a copy of the original bin array. It does not change the receiver.

func (*BinArray) Count

func (b *BinArray) Count() int

Count returns the number of 1 bits in the array. It does not change the receiver.

func (*BinArray) Equal

func (b *BinArray) Equal(w *BinArray) bool

Equal is a deep equality comparison.

func (*BinArray) Get

func (b *BinArray) Get(pos int) uint64

Get returns the pos value of the bin array. It does not change the receiver.

func (*BinArray) Inverse

func (b *BinArray) Inverse() *BinArray

Inverse inverses all bits. Also the ones outside the size area.

func (*BinArray) Is

func (b *BinArray) Is(pos int) bool

Is checks if the pos bit of the bin array is 1. It does not change the receiver.

func (*BinArray) Minus

func (b *BinArray) Minus(w *BinArray) *BinArray

Minus performs the minus boolean operator on all bits. Also on the ones outside the size area.

func (*BinArray) None

func (b *BinArray) None() *BinArray

None sets all bits to 0.

func (*BinArray) Or

func (b *BinArray) Or(w *BinArray) *BinArray

Or performs the or boolean operator on all bits. Also on the ones outside the size area.

func (*BinArray) Set

func (b *BinArray) Set(pos int) *BinArray

Set changes the pos bit to 1 and returns the array.

func (*BinArray) ShiftLeft

func (b *BinArray) ShiftLeft(times int) *BinArray

ShiftLeft shifts all bits times to the left. The parameter times cannot be greater than 64.

func (*BinArray) ShiftRight

func (b *BinArray) ShiftRight(times int) *BinArray

ShiftLeft shifts all bits times to the right. The parameter times cannot be greater than 64.

func (*BinArray) Size

func (b *BinArray) Size() int

Size returns the total number of bits.

func (*BinArray) String

func (b *BinArray) String() string

String returns a string of all bits organized in 64 bits

func (*BinArray) Xor

func (b *BinArray) Xor(w *BinArray) *BinArray

Xor performs the xor boolean operator on all bits. Also on the ones outside the size area.

Jump to

Keyboard shortcuts

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