From 27a0d7e5052d6c40b247bfe4ef8c1611b9907a6a Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Tue, 24 Aug 2021 12:15:50 +0200 Subject: [PATCH] fix(base-n): fix #308, remove unintentional int cast - use Math.floor() in BaseN.encode() to avoid casting intermediate values to 32 bit int range --- packages/base-n/src/base.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base-n/src/base.ts b/packages/base-n/src/base.ts index b13886cc45..bbf90eb0ad 100644 --- a/packages/base-n/src/base.ts +++ b/packages/base-n/src/base.ts @@ -21,7 +21,7 @@ export class BaseN implements IBase { let res = ""; while (x > 0) { res = base[x % N] + res; - x = (x / N) | 0; + x = Math.floor(x / N); } return res; }