Skip to content

Commit ee47a7f

Browse files
refactor(binary): update little endian check (IS_LE const)
1 parent ebcfcc7 commit ee47a7f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/binary/src/float.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import type { FnN, FnN2 } from "@thi.ng/api";
22

33
const F64 = new Float64Array(1);
44
const F32 = new Float32Array(F64.buffer);
5+
const U8 = new Uint8Array(F64.buffer);
56
const I32 = new Int32Array(F64.buffer);
67
const U32 = new Uint32Array(F64.buffer);
78

89
/**
910
* This value is true iff the environment is Little Endian.
1011
*/
11-
export const IS_LE = ((F64[0] = 2), U32[1] === 0x40000000);
12+
export const IS_LE = ((U32[0] = 1), U8[0] === 1);
1213

1314
export const floatToIntBits: FnN = (x) => ((F32[0] = x), I32[0]);
1415

0 commit comments

Comments
 (0)