summaryrefslogtreecommitdiff
path: root/math/shortModInv.cpp
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-04-01 19:59:01 +0200
committerGloria Mundi <gloria@gloria-mundi.eu>2024-04-01 19:59:01 +0200
commit33343f96d94f2d7f12567b1c227e4e2399c8bd1b (patch)
tree16b5ef80ee4605ce88410911fbb6beb6dfc1d7b2 /math/shortModInv.cpp
parent4fc39dcd54243609febc1ce4c8a1470b3d31fd47 (diff)
parent98aa28427350e72cb9abe4071c0c6b6870b7e6cc (diff)
merge mzuenni changes
Diffstat (limited to 'math/shortModInv.cpp')
-rw-r--r--math/shortModInv.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/math/shortModInv.cpp b/math/shortModInv.cpp
index d5eaf07..f696cce 100644
--- a/math/shortModInv.cpp
+++ b/math/shortModInv.cpp
@@ -1,3 +1,3 @@
-ll multInv(ll a, ll b){ // a^{-1} mod b
- return 1 < a ? b - multInv(b % a, a) * b / a : 1;
+ll multInv(ll x, ll m) { // x^{-1} mod m
+ return 1 < x ? m - multInv(m % x, x) * m / x : 1;
}