bigIntToBytesLe
bigIntToBytesLe(
value,byteLength?):Uint8Array<ArrayBuffer>
Defined in: packages/core/src/big-int/to-bytes-le.ts:20
Encodes a bigint as two’s complement, little-endian bytes.
The byte order native to x86 and ARM, and what Python’s int.to_bytes(…, "little") produces. Reach for bigIntToBytesBe when the most
significant byte comes first, which is what wire formats usually specify, and
for @ac-kit/math-integer’s limb32/limb64 families when the digits feed
arithmetic rather than a buffer: those are wider, unsigned, and of fixed
width.
Time complexity: O(n) in the byte count.
Parameters
Section titled “Parameters”bigint
The value to encode. Zero encodes as a single 0x00.
byteLength?
Section titled “byteLength?”number
Fixed output width, sign-extended to fit. Omit for the minimal encoding.
Returns
Section titled “Returns”Uint8Array<ArrayBuffer>
A fresh buffer, never empty.
Throws
Section titled “Throws”When
byteLength is too small to hold value.