UNPKG

esbuild-gas-plugin

Version:
20 lines (19 loc) 607 B
"use strict"; // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. // This module is browser compatible. Object.defineProperty(exports, "__esModule", { value: true }); exports.sliceLongToBytes = void 0; /** * Slice number into 64bit big endian byte array * @param d The number to be sliced * @param dest The sliced array */ function sliceLongToBytes(d, dest = Array.from({ length: 8 })) { let big = BigInt(d); for (let i = 0; i < 8; i++) { dest[7 - i] = Number(big & 0xffn); big >>= 8n; } return dest; } exports.sliceLongToBytes = sliceLongToBytes;