BitArray

A simple, fast array of bits.

Constructors

this
this(int size)

Creates a new bit array with a given size.

Members

Functions

appendBit
void appendBit(bool bit, bool test)

Appends a bit to the array.

appendBitArray
void appendBitArray(BitArray other)

Appends another bit array to this array.

appendBits
void appendBits(int value, int numBits, bool test)

Appends a number of bits (up to 32) to the array.

clear
void clear()

Clears the bit array, unsetting every bit.

ensureCapacity
void ensureCapacity(BitArrayBitType size)

Ensures that the array has a minimum capacity.

flip
void flip(int i)

Flips a specific bit.

get
bool get(long i)

Gets a specific bit.

getBitArray
BitArrayBitType[] getBitArray()

Gets the internal bit array.

getNextSet
long getNextSet(long from)

Gets the next set bit position from a given position.

getNextUnset
ulong getNextUnset(int from)

Gets the next unset bit position from a given position.

getSize
BitArrayBitType getSize()

Gets the size in bits.

getSizeInBytes
BitArrayBitType getSizeInBytes()

Gets the size in bytes.

isRange
bool isRange(int start, int end, int value)

Checks if a range of bits is set or not set.

reverse
void reverse()

Reverses the array.

set
void set(int i)

Sets a specific bit.

setBulk
void setBulk(int i, BitArrayBitType newBits)

Sets a bulk of bits.

setRange
void setRange(int start, int end)

Sets a range of bits.

toBytes
int[] toBytes(int bitOffset, int numBytes)

Converts the bit array to a byte array.

toString
string toString()

Returns a string representation of the bit array.

xorBits
void xorBits(BitArray other)

Makes an exclusive-or comparision on the current bit array.

Variables

bits
BitArrayBitType[] bits;

Bits represented as an array of integers.

size
BitArrayBitType size;

Size of the bit array in bits.

Meta