Skip to content

Commit

Permalink
made it a one-liner
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB committed May 2, 2024
1 parent 0a9606f commit e6d2fb9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/long.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,8 @@ export class Long extends BSONValue {
* @returns The corresponding Long value
*/
static fromBigInt(value: bigint, unsigned?: boolean): Long {
/* eslint-disable no-bigint-usage/no-bigint-literals */
const bit32Mask = 0xffffffffn;

const lowBits = value & bit32Mask;
const highBits = (value >> 32n) & bit32Mask;
/* eslint-enable no-bigint-usage/no-bigint-literals */
return new Long(Number(lowBits), Number(highBits), unsigned);
// eslint-disable-next-line no-bigint-usage/no-bigint-literals
return new Long(Number(value & 0xffffffffn), Number((value >> 32n) & 0xffffffffn), unsigned);
}

/**
Expand Down

0 comments on commit e6d2fb9

Please sign in to comment.