Implementations of Data Structures
https://azusfin.github.io/structures
A static-length array to work with bytes in bit-level
import { BitSet } from "@azusfin/structures"
const bitsAmount = 64
const bitSet = new BitSet(bitsAmount)
const index = 31
bitSet.set(index)
bitSet.get(31) // true
bitSet.get(4) // false
bitSet.flip(31)
bitSet.flip(4)
bitSet.get(31) // false
bitSet.get(4) // true
bitSet.clear(31)
bitSet.clear(4)
bitSet.get(31) // false
bitSet.get(4) // false
An array where each element occupies 4 bit unsigned integer from 0 to 15
import { Uint4Array } from "@azusfin/structures"
const length = 8
const array = new Uint4Array(length)
const offset = 3
array.set(offset, 12)
array.set(1, 6)
array.set(5, 3)
array.get(offset) // 12
array.get(1) // 6
array.get(5) // 3
A subtype of Uint4Array with support of 4 bit signed integer from -8 to 7
import { Int4Array } from "@azusfin/structures"
const length = 8
const array = new Int4Array(length)
const offset = 3
array.set(offset, -4)
array.set(1, -8)
array.set(5, 3)
array.get(offset) // -4
array.get(1) // -8
array.get(5) // 3
Generated using TypeDoc