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

mercurial at gmplib.org mercurial at gmplib.org
Tue Feb 19 07:40:55 CET 2013


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

details:   /var/hg/gmp-5.1/rev/82cdaf1cdeab
changeset: 15392:82cdaf1cdeab
user:      Marco Bodrato <bodrato at mail.dm.unipi.it>
date:      Tue Feb 19 07:40:49 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 e616ff715c34 -r 82cdaf1cdeab ChangeLog
--- a/ChangeLog	Sun Feb 17 19:40:16 2013 +0100
+++ b/ChangeLog	Tue Feb 19 07:40:49 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-16  Marc Glisse  <marc.glisse at inria.fr>
 
 	* gmpxx.h: Include <algorithm>.
diff -r e616ff715c34 -r 82cdaf1cdeab mini-gmp/mini-gmp.c
--- a/mini-gmp/mini-gmp.c	Sun Feb 17 19:40:16 2013 +0100
+++ b/mini-gmp/mini-gmp.c	Tue Feb 19 07:40:49 2013 +0100
@@ -930,11 +930,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]>
@@ -994,7 +994,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)
@@ -1002,9 +1004,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