Functions
getBitArrayCodec
getBitArrayCodec<
TSize
>(size
,config?
):FixedSizeCodec
<boolean
[],boolean
[],TSize
>
Returns a codec that encodes and decodes boolean arrays as compact bit representations.
This codec efficiently stores boolean arrays as bits, packing 8 values per byte.
The backward
config option determines whether bits are stored in MSB-first (false
)
or LSB-first (true
).
Type Parameters
Type Parameter | Description |
---|---|
TSize extends number | The number of bytes used to store the bit array. |
Parameters
Parameter | Type | Description |
---|---|---|
size | TSize | The number of bytes allocated for the bit array (must be sufficient for the expected boolean count). |
config? | boolean | BitArrayCodecConfig | Configuration options for encoding and decoding the bit array. |
Returns
FixedSizeCodec
<boolean
[], boolean
[], TSize
>
A FixedSizeCodec<boolean[], boolean[], TSize>
for encoding and decoding bit arrays.
Examples
Encoding and decoding a bit array.
Encoding and decoding a bit array backwards.
Remarks
Separate getBitArrayEncoder and getBitArrayDecoder functions are available.