Rename internal BigInt helper (#1244)

* Rename internal BigInt helper

* Consistency
This commit is contained in:
Jaco
2021-11-25 17:16:09 +02:00
committed by GitHub
parent b0b0151071
commit 9821eba11f
5 changed files with 44 additions and 46 deletions
+4 -4
View File
@@ -3,11 +3,11 @@
import type { ToBnOptions } from '../types';
import { _BigInt, BI_ONE } from '../bi/consts';
import { _1n, _n } from '../bi/consts';
import { objectSpread } from '../object/spread';
const U8_MAX = _BigInt(256);
const U16_MAX = _BigInt(256 * 256);
const U8_MAX = _n(256);
const U16_MAX = _n(256 * 256);
function xor (input: Uint8Array): Uint8Array {
const result = new Uint8Array(input.length);
@@ -59,6 +59,6 @@ export function u8aToBigInt (value: Uint8Array, options: ToBnOptions = {}): bigi
: value;
return isNegative
? ((toBigInt(xor(u8a)) * -BI_ONE) - BI_ONE)
? ((toBigInt(xor(u8a)) * -_1n) - _1n)
: toBigInt(u8a);
}