From 093b993cc717aabdabc3886dca65bc7ba8b47348 Mon Sep 17 00:00:00 2001 From: Krishna Vedala Date: Wed, 27 May 2020 16:44:58 -0400 Subject: [PATCH] fix cpplint --- math/extended_euclid_algorithm.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/math/extended_euclid_algorithm.cpp b/math/extended_euclid_algorithm.cpp index 84dec55c5..3fdae25b5 100644 --- a/math/extended_euclid_algorithm.cpp +++ b/math/extended_euclid_algorithm.cpp @@ -16,15 +16,15 @@ * function to update the coefficients per iteration * \f[r_0,\,r = r,\, r_0 - \text{quotient}\times r\f] * - * @param[in,out] r signed - * @param[in,out] r0 signed - * @param[in] quotient unsigned input + * @param[in,out] r signed or unsigned + * @param[in,out] r0 signed or unsigned + * @param[in] quotient unsigned */ template -inline void update_step(T &r, T &r0, const T2 quotient) { - T temp = r; - r = r0 - (quotient * temp); - r0 = temp; +inline void update_step(T *r, T *r0, const T2 quotient) { + T temp = *r; + *r = *r0 - (quotient * temp); + *r0 = temp; } /** @@ -47,9 +47,9 @@ void extendedEuclid_1(T1 A, T1 B, T1 *GCD, T2 *x, T2 *y) { while (r != 0) { T1 quotient = r0 / r; - update_step(r, r0, quotient); - update_step(s, s0, quotient); - update_step(t, t0, quotient); + update_step(&r, &r0, quotient); + update_step(&s, &s0, quotient); + update_step(&t, &t0, quotient); } *GCD = r0; *x = s0;