From 6d15fe9b72652c8bab6979397037f81c3a156f16 Mon Sep 17 00:00:00 2001 From: Lisoveliy Date: Thu, 24 Jul 2025 02:23:40 +0300 Subject: [PATCH] fix: fix of BigInt issue of protobuf decoder (special thanks: silver.zepp) --- lib/protobuf-decoder/varintUtils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/protobuf-decoder/varintUtils.js b/lib/protobuf-decoder/varintUtils.js index 6b9b6b4..9a5bfad 100644 --- a/lib/protobuf-decoder/varintUtils.js +++ b/lib/protobuf-decoder/varintUtils.js @@ -1,5 +1,5 @@ export function decodeVarint(buffer, offset) { - let res = this.BigInt(0); + let res = 0; let shift = 0; let byte = 0; @@ -10,8 +10,8 @@ export function decodeVarint(buffer, offset) { byte = buffer[offset++]; - const multiplier = this.BigInt(2) ** this.BigInt(shift); - const thisByteValue = this.BigInt(byte & 0x7f) * multiplier; + const multiplier = 2 ** shift; + const thisByteValue = (byte & 0x7f) * multiplier; shift += 7; res = res + thisByteValue; } while (byte >= 0x80);