Skip to content

Commit

Permalink
fix: πŸ› fix encode int64 <4294967295
Browse files Browse the repository at this point in the history
  • Loading branch information
binsee committed Dec 7, 2022
1 parent f72ce4d commit ede0524
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util/longbits.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ function LongBits(lo, hi) {
* Low bits.
* @type {number}
*/
this.lo = lo | 0;
this.lo = lo;

/**
* High bits.
* @type {number}
*/
this.hi = hi | 0;
this.hi = hi;
}

/**
Expand Down Expand Up @@ -56,8 +56,8 @@ LongBits.fromBigInt = function fromNumber(value) {
if (negative) {
value = -value;
}
var hi = Number(value >> 32n) | 0;
var lo = Number(value - ( BigInt(hi) << 32n ) ) | 0;
var hi = Number(value >> 32n);
var lo = Number(value - ( BigInt(hi) << 32n ) );

if (negative) {
hi = ~hi >>> 0;
Expand Down

0 comments on commit ede0524

Please sign in to comment.