Skip to content

Commit

Permalink
u64: clarify comments
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Oct 11, 2024
1 parent 6d6e34d commit 8884532
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/_u64.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
const _32n = /* @__PURE__ */ BigInt(32);

// We are not using BigUint64Array, because they are extremely slow as per 2022
// BigUint64Array is too slow as per 2024, so we implement it using Uint32Array.
// TODO: re-check https://issues.chromium.org/issues/42212588

function fromBig(n: bigint, le = false) {
if (le) return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
Expand Down

0 comments on commit 8884532

Please sign in to comment.