[libmath-prime-util-perl] 27/55: Compiler warnings
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:53:41 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.41
in repository libmath-prime-util-perl.
commit 54052c0efdfc6ce8032063c151649fd296a4ef79
Author: Dana Jacobsen <dana at acm.org>
Date: Wed May 7 15:51:19 2014 -0700
Compiler warnings
---
primality.c | 9 +++++----
util.c | 4 ++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/primality.c b/primality.c
index 5f4a633..025b4ff 100644
--- a/primality.c
+++ b/primality.c
@@ -205,17 +205,18 @@ int _XS_is_pseudoprime(UV const n, UV a)
*/
int _XS_miller_rabin(UV const n, const UV *bases, int nbases)
{
+#if USE_MONT_PRIMALITY
+ MPUassert(n > 3, "MR called with n <= 3");
+ if ((n & 1) == 0) return 0;
+ return monty_mr64((uint64_t)n, bases, nbases);
+#else
UV d = n-1;
int b, r, s = 0;
MPUassert(n > 3, "MR called with n <= 3");
if ((n & 1) == 0) return 0;
-#if USE_MONT_PRIMALITY
- return monty_mr64((uint64_t)n, bases, nbases);
-#else
while (!(d&1)) { s++; d >>= 1; }
-
for (b = 0; b < nbases; b++) {
UV x, a = bases[b];
if (a < 2) croak("Base %"UVuf" is invalid", a);
diff --git a/util.c b/util.c
index 69580fe..0dcdc03 100644
--- a/util.c
+++ b/util.c
@@ -1454,7 +1454,7 @@ UV znorder(UV a, UV n) {
UV znprimroot(UV n) {
UV fac[MPU_MAX_FACTORS+1];
UV exp[MPU_MAX_FACTORS+1];
- UV a, j, phi;
+ UV a, phi;
int i, nfactors;
if (n <= 4) return (n == 0) ? 0 : n-1;
if (n % 4 == 0) return 0;
@@ -1465,7 +1465,7 @@ UV znprimroot(UV n) {
else nfactors = 0;
if (nfactors != 1) return 0;
phi = fac[0]-1; /* n = p^a for odd prime p. Calculate totient. */
- for (i = 1; i < exp[0]; i++)
+ for (i = 1; i < (int)exp[0]; i++)
phi *= fac[0];
}
nfactors = factor_exp(phi, fac, exp);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git
More information about the Pkg-perl-cvs-commits
mailing list