A fast boolean array backed by a Uint32Array
BooleanArray(size: number)
Creates a new BooleanArray
clear(): this
Clear the array
Creates a copy of this BooleanArray
getFirstSetIndex(startIndex?: number): number
Get the index of the first set bit starting from a given index
getLastSetIndex(startIndex?: number): number
Get the index of the last set bit
Get the number of set bits in the array
setAll(): this
Set all bits to true
Set a range of bits to a given value
toggleBool(index: number): boolean
Toggle the boolean state of a bit
truthyIndices(): IterableIterator<number>
Get the indices of the set bits in the array
ALL_BITS: 4294967295
The mask for all bits (~0 >>> 0)
BITS_PER_INT: 32
The number of bits per integer
CHUNK_MASK: 31
The mask for the chunk offset
CHUNK_SHIFT: 5
The shift for the chunk offset
The threshold for what is considered a dense array
The threshold for what is considered a large array
MAX_SAFE_SIZE: 536870911
The maximum safe size for bit operations
and(a: BooleanArray,b: BooleanArray,): BooleanArray
Performs a bitwise AND operation with two BooleanArrays
difference(a: BooleanArray,b: BooleanArray,): BooleanArray
Performs a bitwise difference operation with two BooleanArrays
equals(a: BooleanArray,b: BooleanArray,): boolean
Checks if two BooleanArrays are equal
Create a BooleanArray from an array of numbers, each number representing a bit to set to true.
fromObjects<T>(): BooleanArray
Create a BooleanArray from an object, using the object's keys as the bit indices.
getChunkCount(bools: number): number
Get the number of chunks required to accommodate a given number of bools
getChunkOffset(boolIndex: number): number
Get the offset of a bool within a chunk
nand(a: BooleanArray,b: BooleanArray,): BooleanArray
Performs a bitwise NAND operation with two BooleanArrays
nor(a: BooleanArray,b: BooleanArray,): BooleanArray
Performs a bitwise NOR operation with two BooleanArrays
not(a: BooleanArray): BooleanArray
Performs a bitwise NOT operation with a BooleanArray
Performs a bitwise operation with two BooleanArrays
or(a: BooleanArray,b: BooleanArray,): BooleanArray
Performs a bitwise OR operation with two BooleanArrays
Validate a value
xnor(a: BooleanArray,b: BooleanArray,): BooleanArray
Performs a bitwise XNOR operation with two BooleanArrays
xor(a: BooleanArray,b: BooleanArray,): BooleanArray
Performs a bitwise XOR operation with two BooleanArrays