From 6dbd3beaa728a2dd7b484789af01d99eb74edf9d Mon Sep 17 00:00:00 2001 From: CarlosZoft <62192072+CarlosZoft@users.noreply.github.com> Date: Tue, 15 Feb 2022 14:53:35 -0300 Subject: [PATCH] fix : removed macro and initialize variable aux --- math/modular_inverse_simple.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/math/modular_inverse_simple.cpp b/math/modular_inverse_simple.cpp index 9f5aab005..ba399549b 100644 --- a/math/modular_inverse_simple.cpp +++ b/math/modular_inverse_simple.cpp @@ -13,10 +13,6 @@ #include #include -// Macro -#define Key(A) (A) -#define module(A, B) (Key(A) % Key(B)) - using namespace std; /** @@ -27,13 +23,13 @@ using namespace std; * @returns the modular inverse */ int imod(int x, int y) { - int aux; + int aux = 0; int itr = 0; do { // run the algorithm while not find the inverse aux = y * itr + 1; itr++; - } while (module(aux, x)); // while module(aux, x) is different of zero + } while (aux % x); // while module aux % x is different of zero return aux / x; }