@bithomp/xrpl-api
Version:
A Bithomp JavaScript/TypeScript library for interacting with the XRP Ledger
20 lines (19 loc) • 723 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseUint64 = exports.parseUint32 = void 0;
function parseUint32(buf, cur) {
return ((BigInt(buf[cur]) << 24n) + (BigInt(buf[cur + 1]) << 16n) + (BigInt(buf[cur + 2]) << 8n) + BigInt(buf[cur + 3]) + "");
}
exports.parseUint32 = parseUint32;
function parseUint64(buf, cur) {
return ((BigInt(buf[cur]) << 56n) +
(BigInt(buf[cur + 1]) << 48n) +
(BigInt(buf[cur + 2]) << 40n) +
(BigInt(buf[cur + 3]) << 32n) +
(BigInt(buf[cur + 4]) << 24n) +
(BigInt(buf[cur + 5]) << 16n) +
(BigInt(buf[cur + 6]) << 8n) +
BigInt(buf[cur + 7]) +
"");
}
exports.parseUint64 = parseUint64;
;