Skip to content

Commit 196f29d

Browse files
authored
Merge pull request #227 from ChALkeR/chalker/perf/invert/0
perf: faster invert
2 parents 5070918 + bae5525 commit 196f29d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/abstract/modular.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ export function invert(number: bigint, modulo: bigint): bigint {
6262
// prettier-ignore
6363
let x = _0n, y = _1n, u = _1n, v = _0n;
6464
while (a !== _0n) {
65-
// JIT applies optimization if those two lines follow each other
6665
const q = b / a;
67-
const r = b % a;
66+
const r = b - a * q;
6867
const m = x - u * q;
6968
const n = y - v * q;
7069
// prettier-ignore

0 commit comments

Comments
 (0)