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

mercurial at gmplib.org mercurial at gmplib.org
Thu May 5 22:52:01 CEST 2011


details:   /var/hg/gmp/rev/08ad8ac3a4f4
changeset: 14167:08ad8ac3a4f4
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu May 05 22:49:27 2011 +0200
description:
Correct sgn computation.

details:   /var/hg/gmp/rev/482053e697a0
changeset: 14168:482053e697a0
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu May 05 22:51:35 2011 +0200
description:
Use MPZ_REALLOC.

details:   /var/hg/gmp/rev/68820ed796d9
changeset: 14169:68820ed796d9
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Thu May 05 22:51:45 2011 +0200
description:
*** empty log message ***

diffstat:

 ChangeLog    |   5 +++++
 mpz/gcdext.c |  20 +++++++-------------
 2 files changed, 12 insertions(+), 13 deletions(-)

diffs (62 lines):

diff -r 93e8579e4b85 -r 68820ed796d9 ChangeLog
--- a/ChangeLog	Thu May 05 21:02:58 2011 +0200
+++ b/ChangeLog	Thu May 05 22:51:45 2011 +0200
@@ -1,3 +1,8 @@
+2011-05-05  Torbjorn Granlund  <tege at gmplib.org>
+
+	* mpz/gcdext.c: Correct sgn computation.
+	Use MPZ_REALLOC.
+
 2011-05-05  Marc Glisse  <marc.glisse at inria.fr>
 
 	* mpn/x86_64/fat/fat.c: Update for Sandy Bridge.
diff -r 93e8579e4b85 -r 68820ed796d9 mpz/gcdext.c
--- a/mpz/gcdext.c	Thu May 05 21:02:58 2011 +0200
+++ b/mpz/gcdext.c	Thu May 05 22:51:45 2011 +0200
@@ -50,14 +50,12 @@
       MPZ_PTR_SWAP (s, t);
     }
 
-  if (bsize == 0)    
+  if (bsize == 0)
     {
-      /* g = |a|, s = sign(a), t = 0. */
-      ssize = SIZ (a) >= 0 ? 1 : -1;
+      /* g = |a|, s = sgn(a), t = 0. */
+      ssize = SIZ (a) >= 0 ? (asize != 0) : -1;
 
-      if (ALLOC (g) < asize)
-	_mpz_realloc (g, asize);
-      gp = PTR (g);
+      gp = MPZ_REALLOC (g, asize);
       MPN_COPY (gp, ap, asize);
       SIZ (g) = asize;
 
@@ -77,7 +75,7 @@
   tmp_bp = TMP_ALLOC_LIMBS (bsize);
   MPN_COPY (tmp_ap, ap, asize);
   MPN_COPY (tmp_bp, bp, bsize);
-  
+
   tmp_gp = TMP_ALLOC_LIMBS (bsize);
   tmp_sp = TMP_ALLOC_LIMBS (bsize);
 
@@ -102,16 +100,12 @@
 
   if (s != NULL)
     {
-      if (ALLOC (s) < ssize)
-	_mpz_realloc (s, ssize);
-      sp = PTR (s);
+      sp = MPZ_REALLOC (s, ssize);
       MPN_COPY (sp, tmp_sp, ssize);
       SIZ (s) = SIZ (&stmp);
     }
 
-  if (ALLOC (g) < gsize)
-    _mpz_realloc (g, gsize);
-  gp = PTR (g);
+  gp = MPZ_REALLOC (g, gsize);
   MPN_COPY (gp, tmp_gp, gsize);
   SIZ (g) = gsize;
 


More information about the gmp-commit mailing list