File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -83,16 +83,23 @@ export const NumberUtils: NumberUtils = {
83
83
84
84
/** Reads a little-endian 64-bit integer from source */
85
85
getBigInt64LE ( source : Uint8Array , offset : number ) : bigint {
86
- const lo = NumberUtils . getUint32LE ( source , offset ) ;
87
- const hi = NumberUtils . getUint32LE ( source , offset + 4 ) ;
88
-
89
- /*
90
- eslint-disable no-restricted-globals
91
- -- This is allowed since this helper should not be called unless bigint features are enabled
92
- */
93
- const intermediate = ( BigInt ( hi ) << BigInt ( 32 ) ) + BigInt ( lo ) ;
94
- return BigInt . asIntN ( 64 , intermediate ) ;
95
- /* eslint-enable no-restricted-globals */
86
+ // eslint-disable-next-line no-restricted-globals
87
+ const hi = BigInt (
88
+ source [ offset + 4 ] +
89
+ source [ offset + 5 ] * 256 +
90
+ source [ offset + 6 ] * 65536 +
91
+ ( source [ offset + 7 ] << 24 )
92
+ ) ; // Overflow
93
+
94
+ // eslint-disable-next-line no-restricted-globals
95
+ const lo = BigInt (
96
+ source [ offset ] +
97
+ source [ offset + 1 ] * 256 +
98
+ source [ offset + 2 ] * 65536 +
99
+ source [ offset + 3 ] * 16777216
100
+ ) ;
101
+ // eslint-disable-next-line no-restricted-globals
102
+ return ( hi << BigInt ( 32 ) ) + lo ;
96
103
} ,
97
104
98
105
/** Reads a little-endian 64-bit float from source */
You can’t perform that action at this time.
0 commit comments