From: Chris Duncan Date: Tue, 12 May 2026 18:37:37 +0000 (-0700) Subject: Return real byte array if input is literal zero. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=5eceddf06e2314a88306405bb735213b1a1a65d4;p=libnemo.git Return real byte array if input is literal zero. --- diff --git a/src/lib/convert.ts b/src/lib/convert.ts index fb0e271..6362793 100644 --- a/src/lib/convert.ts +++ b/src/lib/convert.ts @@ -207,7 +207,7 @@ export class dec { throw new TypeError('Invalid padding') } let integer = BigInt(decimal) - const bytes: number[] = [] + const bytes: number[] = (integer === 0n) ? [0] : [] while (integer > 0) { const lsb = BigInt.asUintN(8, integer) bytes.push(Number(lsb))