mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-13 20:04:35 +03:00
BigIntArrayOrderedMap: reverse BigInteger arrays before sorting them
This commit is contained in:
parent
8146a65f0a
commit
8b44213faf
@ -32,11 +32,16 @@ export function sortBigIntArr(a: BigInteger[], b: BigInteger[]) {
|
||||
let aLen = a.length;
|
||||
let bLen = b.length;
|
||||
|
||||
let aCop = a.slice();
|
||||
let bCop = b.slice();
|
||||
aCop.reverse();
|
||||
bCop.reverse();
|
||||
|
||||
let i = 0;
|
||||
while (i < aLen && i < bLen) {
|
||||
if (a[i].lt(b[i])) {
|
||||
if (aCop[i].lt(bCop[i])) {
|
||||
return 1;
|
||||
} else if (a[i].gt(b[i])) {
|
||||
} else if (aCop[i].gt(bCop[i])) {
|
||||
return -1;
|
||||
} else {
|
||||
i++;
|
||||
|
Loading…
Reference in New Issue
Block a user