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

mercurial at gmplib.org mercurial at gmplib.org
Tue Feb 19 07:41:45 CET 2013


details:   /var/hg/gmp/rev/e5b361eb2455
changeset: 15461:e5b361eb2455
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Feb 19 07:37:23 2013 +0100
description:
mini-gmp/mini-gmp.c: Move asserts to work-around a compiler bug.

details:   /var/hg/gmp/rev/f3b3bd788ddb
changeset: 15462:f3b3bd788ddb
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Feb 19 07:41:36 2013 +0100
description:
ChangeLog

diffstat:

 ChangeLog           |  4 ++++
 mini-gmp/mini-gmp.c |  9 ++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 463d91873945 -r f3b3bd788ddb ChangeLog
--- a/ChangeLog	Mon Feb 18 22:41:17 2013 +0100
+++ b/ChangeLog	Tue Feb 19 07:41:36 2013 +0100
@@ -1,3 +1,7 @@
+2013-02-19 Marco Bodrato <bodrato at mail.dm.unipi.it>
+
+        * mini-gmp/mini-gmp.c: Move asserts to work-around a compiler bug. 
+
 2013-02-17 Marco Bodrato <bodrato at mail.dm.unipi.it>
 
 	* gmpxx.h (mpq_class, mpf_class) [init_ui, init_si, assign_si]:
diff -r 463d91873945 -r f3b3bd788ddb mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Mon Feb 18 22:41:17 2013 +0100
+++ b/mini-gmp/mini-gmp.c	Tue Feb 19 07:41:36 2013 +0100
@@ -931,11 +931,11 @@
 
   assert (dn > 2);
   assert (nn >= dn);
-  assert ((dp[dn-1] & GMP_LIMB_HIGHBIT) != 0);
 
   d1 = dp[dn - 1];
   d0 = dp[dn - 2];
 
+  assert ((d1 & GMP_LIMB_HIGHBIT) != 0);
   /* Iteration variable is the index of the q limb.
    *
    * We divide <n1, np[dn-1+i], np[dn-2+i], np[dn-3+i],..., np[i]>
@@ -995,7 +995,9 @@
       mp_limb_t nh;
       unsigned shift;
 
-      assert (dp[dn-1] & GMP_LIMB_HIGHBIT);
+      assert (inv->d1 == dp[dn-1]);
+      assert (inv->d0 == dp[dn-2]);
+      assert ((inv->d1 & GMP_LIMB_HIGHBIT) != 0);
 
       shift = inv->shift;
       if (shift > 0)
@@ -1003,9 +1005,6 @@
       else
 	nh = 0;
 
-      assert (inv->d1 == dp[dn-1]);
-      assert (inv->d0 == dp[dn-2]);
-
       mpn_div_qr_pi1 (qp, np, nn, nh, dp, dn, inv->di);
 
       if (shift > 0)


More information about the gmp-commit mailing list