in javascript/packages/fury/lib/reader/index.ts [236:319]
varUInt64() {
// Creating BigInts is too performance-intensive; we'll use uint32 instead.
if (this.byteLength - this.cursor < 8) {
let byte = this.bigUInt8();
let result = byte & 0x7fn;
if ((byte & 0x80n) != 0n) {
byte = this.bigUInt8();
result |= (byte & 0x7fn) << 7n;
if ((byte & 0x80n) != 0n) {
byte = this.bigUInt8();
result |= (byte & 0x7fn) << 14n;
if ((byte & 0x80n) != 0n) {
byte = this.bigUInt8();
result |= (byte & 0x7fn) << 21n;
if ((byte & 0x80n) != 0n) {
byte = this.bigUInt8();
result |= (byte & 0x7fn) << 28n;
if ((byte & 0x80n) != 0n) {
byte = this.bigUInt8();
result |= (byte & 0x7fn) << 35n;
if ((byte & 0x80n) != 0n) {
byte = this.bigUInt8();
result |= (byte & 0x7fn) << 42n;
if ((byte & 0x80n) != 0n) {
byte = this.bigUInt8();
result |= (byte & 0x7fn) << 49n;
if ((byte & 0x80n) != 0n) {
byte = this.bigUInt8();
result |= (byte) << 56n;
}
}
}
}
}
}
}
}
return result;
}
const l32 = this.dataView.getUint32(this.cursor++, true);
let byte = l32 & 0xff;
let rl28 = byte & 0x7f;
let rh28 = 0;
if ((byte & 0x80) != 0) {
byte = l32 & 0xff00 >> 8;
this.cursor++;
rl28 |= (byte & 0x7f) << 7;
if ((byte & 0x80) != 0) {
byte = l32 & 0xff0000 >> 16;
this.cursor++;
rl28 |= (byte & 0x7f) << 14;
if ((byte & 0x80) != 0) {
byte = l32 & 0xff000000 >> 24;
this.cursor++;
rl28 |= (byte & 0x7f) << 21;
if ((byte & 0x80) != 0) {
const h32 = this.dataView.getUint32(this.cursor++, true);
byte = h32 & 0xff;
rh28 |= (byte & 0x7f);
if ((byte & 0x80) != 0) {
byte = h32 & 0xff00 >> 8;
this.cursor++;
rh28 |= (byte & 0x7f) << 7;
if ((byte & 0x80) != 0) {
byte = h32 & 0xff0000 >> 16;
this.cursor++;
rh28 |= (byte & 0x7f) << 14;
if ((byte & 0x80) != 0) {
byte = h32 & 0xff000000 >> 24;
this.cursor++;
rh28 |= (byte & 0x7f) << 21;
if ((byte & 0x80) != 0) {
return (BigInt(this.uint8()) << 56n) | BigInt(rh28) << 28n | BigInt(rl28);
}
}
}
}
}
}
}
}
return BigInt(rh28) << 28n | BigInt(rl28);
}