Merge "Fix a compatibility issue: getBigUint64."

This commit is contained in:
Treehugger Robot
2021-07-28 21:50:02 +00:00
committed by Gerrit Code Review

View File

@@ -78,6 +78,15 @@ export class Payload {
readInt(size) {
let /** DataView */ view = new DataView(
this.buffer.slice(this.cursor, this.cursor + size))
if (typeof view.getBigUint64 !== "function") {
view.getBigUint64 =
function(offset) {
const a = BigInt(view.getUint32(offset))
const b = BigInt(view.getUint32(offset + 4))
const bigNumber = a * 4294967296n + b
return bigNumber
}
}
this.cursor += size
switch (size) {
case 2: