domoritz commented on code in PR #40729:
URL: https://github.com/apache/arrow/pull/40729#discussion_r1534940833


##########
js/src/util/bn.ts:
##########
@@ -68,25 +68,36 @@ Object.assign(SignedBigNum.prototype, BigNum.prototype, { 
'constructor': SignedB
 Object.assign(UnsignedBigNum.prototype, BigNum.prototype, { 'constructor': 
UnsignedBigNum, 'signed': false, 'TypedArray': Uint32Array, 'BigIntArray': 
BigUint64Array });
 Object.assign(DecimalBigNum.prototype, BigNum.prototype, { 'constructor': 
DecimalBigNum, 'signed': true, 'TypedArray': Uint32Array, 'BigIntArray': 
BigUint64Array });
 
+//FOR ES2020 COMPATIBILITY
+const TWO_TO_THE_64 = BigInt(4294967296) * BigInt(4294967296); // 2^32 * 2^32 
= 0x10000000000000000n
+const TWO_TO_THE_64_MINUS_1 = TWO_TO_THE_64 - BigInt(1); // (2^32 * 2^32) - 1 
= 0xFFFFFFFFFFFFFFFFn
+
 /** @ignore */
-function bigNumToNumber<T extends BN<BigNumArray>>(bn: T) {
-    const { buffer, byteOffset, length, 'signed': signed } = bn;
-    const words = new BigUint64Array(buffer, byteOffset, length);
+export const bigNumToNumber: { <T extends BN<BigNumArray>>(bn: T, 
denominator?: bigint): number } = (<T extends BN<BigNumArray>>(bn: T, 
denominator?: bigint) => {

Review Comment:
   Let's leave this as a function. I think the "functions" below also should be 
functions and not consts with an arrow function. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to