From fc13431939798fe7d61b8d57d56a939d5b8a0de9 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 17 May 2019 04:17:44 -0400 Subject: [PATCH] Clear GCC unknown pragma warning --- nbtheory.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nbtheory.cpp b/nbtheory.cpp index de812374..310e6cb9 100644 --- a/nbtheory.cpp +++ b/nbtheory.cpp @@ -646,6 +646,7 @@ bool SolveModularQuadraticEquation(Integer &r1, Integer &r2, const Integer &a, c Integer ModularRoot(const Integer &a, const Integer &dp, const Integer &dq, const Integer &p, const Integer &q, const Integer &u) { +#ifdef _OPENMP Integer p2, q2; #pragma omp parallel #pragma omp sections @@ -655,6 +656,11 @@ Integer ModularRoot(const Integer &a, const Integer &dp, const Integer &dq, #pragma omp section q2 = ModularExponentiation((a % q), dq, q); } +#else + const Integer p2 = ModularExponentiation((a % p), dp, p); + const Integer q2 = ModularExponentiation((a % q), dq, q); +#endif + return CRT(p2, p, q2, q, u); } @@ -997,7 +1003,9 @@ Integer Lucas(const Integer &n, const Integer &P, const Integer &modulus) Integer InverseLucas(const Integer &e, const Integer &m, const Integer &p, const Integer &q, const Integer &u) { - Integer d = (m*m-4); + const Integer d = (m*m-4); + +#ifdef _OPENMP Integer p2, q2; #pragma omp parallel #pragma omp sections @@ -1013,6 +1021,14 @@ Integer InverseLucas(const Integer &e, const Integer &m, const Integer &p, const q2 = Lucas(EuclideanMultiplicativeInverse(e,q2), m, q); } } +#else + const Integer t1 = p-Jacobi(d,p); + const Integer p2 = Lucas(EuclideanMultiplicativeInverse(e,t1), m, p); + + const Integer t2 = q-Jacobi(d,q); + const Integer q2 = Lucas(EuclideanMultiplicativeInverse(e,t2), m, q); +#endif + return CRT(p2, p, q2, q, u); }