[Gmp-commit] /var/hg/gmp: 2 new changesets

mercurial at gmplib.org mercurial at gmplib.org
Mon Dec 5 00:13:45 UTC 2016


details:   /var/hg/gmp/rev/80fed342f9f6
changeset: 17159:80fed342f9f6
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Dec 05 01:09:48 2016 +0100
description:
mpz/oddfac_1.c: Revision of the ASSERTs.

details:   /var/hg/gmp/rev/3c41f3c03a10
changeset: 17160:3c41f3c03a10
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Mon Dec 05 01:13:17 2016 +0100
description:
mpz/gcdext.c: Use mpz_t instead of __mpz_struct.

diffstat:

 mpz/gcdext.c   |  14 +++++++-------
 mpz/oddfac_1.c |   8 ++++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diffs (60 lines):

diff -r 6ef9ffecc52c -r 3c41f3c03a10 mpz/gcdext.c
--- a/mpz/gcdext.c	Sun Dec 04 00:17:26 2016 +0100
+++ b/mpz/gcdext.c	Mon Dec 05 01:13:17 2016 +0100
@@ -94,17 +94,17 @@
   if (t != NULL)
     {
       mpz_t x;
-      __mpz_struct gtmp, stmp;
+      mpz_t gtmp, stmp;
 
-      PTR (&gtmp) = tmp_gp;
-      SIZ (&gtmp) = gsize;
+      PTR (gtmp) = tmp_gp;
+      SIZ (gtmp) = gsize;
 
-      PTR (&stmp) = tmp_sp;
-      SIZ (&stmp) = tmp_ssize;
+      PTR (stmp) = tmp_sp;
+      SIZ (stmp) = tmp_ssize;
 
       MPZ_TMP_INIT (x, ssize + asize + 1);
-      mpz_mul (x, &stmp, a);
-      mpz_sub (x, &gtmp, x);
+      mpz_mul (x, stmp, a);
+      mpz_sub (x, gtmp, x);
       mpz_divexact (t, x, b);
     }
 
diff -r 6ef9ffecc52c -r 3c41f3c03a10 mpz/oddfac_1.c
--- a/mpz/oddfac_1.c	Sun Dec 04 00:17:26 2016 +0100
+++ b/mpz/oddfac_1.c	Mon Dec 05 01:13:17 2016 +0100
@@ -189,7 +189,7 @@
   mp_limb_t prod, max_prod;
   mp_size_t j;
 
-  ASSERT (n >= 26);
+  ASSERT (n > 25);
 
   j = 0;
   prod  = -(n & 1);
@@ -208,8 +208,8 @@
     s = limb_apprsqrt(n);
     ASSERT (s >= 5);
     s = n_to_bit (s);
-    /* ASSERT (bit_to_n (s+1) * bit_to_n (s+1) > n); */
-    ASSERT (s <= n_to_bit (n / 3));
+    ASSERT (bit_to_n (s+1) * bit_to_n (s+1) > n);
+    ASSERT (s < n_to_bit (n / 3));
     LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (5), s, 0,sieve);
     SWING_A_PRIME (prime, n, prod, max_prod, factors, j);
     LOOP_ON_SIEVE_STOP;
@@ -277,7 +277,7 @@
 mpz_oddfac_1 (mpz_ptr x, mp_limb_t n, unsigned flag)
 {
   ASSERT (n <= GMP_NUMB_MAX);
-  ASSERT (flag == 0 || (flag == 1 && n > ODD_FACTORIAL_TABLE_LIMIT && ABOVE_THRESHOLD (n, FAC_DSC_THRESHOLD)));
+  ASSERT (flag == 0 || (flag == 1 && n > ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 1 && ABOVE_THRESHOLD (n, FAC_DSC_THRESHOLD)));
 
   if (n <= ODD_FACTORIAL_TABLE_LIMIT)
     {


More information about the gmp-commit mailing list