oasis-std
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -504,3 +504,5 @@ "use strict"; | ||
this.buf[this.offset++] = lo; | ||
let hi = Number((value >> BigInt('32')) & BigInt('0xffffffff')); | ||
const divisor = BigInt(Math.pow(2, 32)); | ||
const rounder = value < BigInt(0) ? -divisor + BigInt(-1) : BigInt(0); | ||
let hi = Number(((value + rounder) / divisor) & BigInt('0xffffffff')); | ||
this.buf[this.offset++] = hi; | ||
@@ -656,2 +658,5 @@ hi = hi >> 8; | ||
readBigUInt64LE(offset = 0) { | ||
if (this.buf.readBigUInt64LE) { | ||
return this.buf.readBigUInt64LE(this.offset); | ||
} | ||
const first = this.buf[offset]; | ||
@@ -669,3 +674,3 @@ const last = this.buf[offset + 7]; | ||
last * Math.pow(2, 24); | ||
return BigInt(lo) + (BigInt(hi) << BigInt('32')); | ||
return BigInt(lo) + BigInt(hi) * Math.pow(BigInt(2), BigInt(32)); | ||
} | ||
@@ -676,2 +681,5 @@ // TODO: Refactor to feross | ||
readBigInt64LE(offset = 0) { | ||
if (this.buf.readBigInt64LE) { | ||
return this.buf.readBigInt64LE(this.offset); | ||
} | ||
const first = this.buf[offset]; | ||
@@ -689,3 +697,3 @@ const last = this.buf[offset + 7]; | ||
this.buf[++offset] * Math.pow(2, 24); | ||
return BigInt(lo) + (BigInt(hi) << BigInt('32')); | ||
return BigInt(lo) + BigInt(hi) * Math.pow(BigInt(2), BigInt(32)); | ||
} | ||
@@ -692,0 +700,0 @@ readU8Array(length) { |
{ | ||
"name": "oasis-std", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Oasis platform standard library", | ||
@@ -29,3 +29,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "7081e2cb724dc1123f2e1e7050f671158d9802cd" | ||
"gitHead": "2e30aa825b848b8507d48b130a6166c80afa2571" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2074
307541