bitarray

package module
v0.1.4 Latest Latest
Warning

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

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

README

bitarray

GoDoc

BitArray is an efficient implementation of an array of bits (boolean array).

The implementation is based on an array of 64bit integers.

The interface offers all binary operators.

Documentation

Index

Constants

View Source
const (
	INTSIZE = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BitArray added in v0.1.1

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

func New added in v0.1.1

func New(size int) *BitArray

New returns a *BitArray with the provided size.

func (*BitArray) All added in v0.1.1

func (b *BitArray) All() *BitArray

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

func (*BitArray) And added in v0.1.1

func (b *BitArray) And(w *BitArray) *BitArray

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

func (*BitArray) Clone added in v0.1.1

func (b *BitArray) Clone() *BitArray

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

func (*BitArray) Count added in v0.1.1

func (b *BitArray) Count() int

Count returns the number of 1 bits in the array. It sets all the bits outside the size to 0.

func (*BitArray) Equal added in v0.1.1

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

Equal is a deep equality comparison.

func (*BitArray) Get added in v0.1.1

func (b *BitArray) Get(index int) uint64

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

func (*BitArray) Inverse added in v0.1.1

func (b *BitArray) Inverse() *BitArray

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

func (*BitArray) Is added in v0.1.1

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

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

func (*BitArray) Minus added in v0.1.1

func (b *BitArray) Minus(w *BitArray) *BitArray

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

func (*BitArray) None added in v0.1.1

func (b *BitArray) None() *BitArray

None sets all bits to 0.

func (*BitArray) Or added in v0.1.1

func (b *BitArray) Or(w *BitArray) *BitArray

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

func (*BitArray) Set added in v0.1.1

func (b *BitArray) Set(index int) *BitArray

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

func (*BitArray) ShiftLeft added in v0.1.1

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

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

func (*BitArray) ShiftRight added in v0.1.1

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

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

func (*BitArray) Size added in v0.1.1

func (b *BitArray) Size() int

Size returns the size of the bit array.

func (*BitArray) String added in v0.1.1

func (b *BitArray) String() string

String returns a string of all bits organized in 64 bits

func (*BitArray) StringBreak added in v0.1.4

func (b *BitArray) StringBreak(breakLine int) string

StringBreak returns a string of all bits inside the range organized in breakLine number of bits

func (*BitArray) Xor added in v0.1.1

func (b *BitArray) Xor(w *BitArray) *BitArray

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