fix: fix of BigInt issue of protobuf decoder (special thanks: silver.zepp)
This commit is contained in:
parent
53233bffea
commit
6d15fe9b72
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user