mirror of
https://github.com/morluto/rea.git
synced 2026-12-05 14:31:22 +00:00
refactor(binary): reuse the 64-bit scalar reader for signed values (#16770)
This commit is contained in:
1 parent
25def6f31f
commit
2fc54591f8
1 file changed
+1
-5
@@ -380,11 +380,7 @@ export const readInt64At = (
|
||||
bytes: Uint8Array,
|
||||
offset: number,
|
||||
little: boolean,
|
||||
): bigint => {
|
||||
const lo = readUint32At(bytes, little ? offset : offset + 4, little);
|
||||
const hi = readInt32At(bytes, little ? offset + 4 : offset, little);
|
||||
return (BigInt(hi) << 32n) | BigInt(lo);
|
||||
};
|
||||
): bigint => BigInt.asIntN(64, readUint64At(bytes, offset, little));
|
||||
|
||||
/** Reader that checks every structural range before decoding numeric fields. */
|
||||
export class BinaryReader {
|
||||
|
||||
Reference in new issue
Block a user