[Gmp-commit] /var/hg/gmp: Collapse MPZ_REALLOC(x,.) and PTR(x).

mercurial at gmplib.org mercurial at gmplib.org
Fri Feb 24 11:27:06 CET 2012


details:   /var/hg/gmp/rev/142b66e668b7
changeset: 14671:142b66e668b7
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Fri Feb 24 11:27:02 2012 +0100
description:
Collapse MPZ_REALLOC(x,.) and PTR(x).

diffstat:

 ChangeLog     |  4 ++++
 mpq/md_2exp.c |  3 +--
 mpq/set_d.c   |  3 +--
 mpq/set_f.c   |  9 +++------
 4 files changed, 9 insertions(+), 10 deletions(-)

diffs (66 lines):

diff -r 0890e16b792f -r 142b66e668b7 ChangeLog
--- a/ChangeLog	Fri Feb 24 11:14:11 2012 +0100
+++ b/ChangeLog	Fri Feb 24 11:27:02 2012 +0100
@@ -39,6 +39,10 @@
 
 	* gmpxx.h (__gmp_set_expr): Use mpq_set_z.
 
+	* mpq/md_2exp.c: Collapse MPZ_REALLOC(x,.) and PTR(x).
+	* mpq/set_d.c: Likewise.
+	* mpq/set_f.c: Likewise.
+
 2012-02-24  Niels Möller  <nisse at lysator.liu.se>
 
 	* mpn/x86_64/core2/aorsmul_1.asm: Added mpn_addmul_1c and
diff -r 0890e16b792f -r 142b66e668b7 mpq/md_2exp.c
--- a/mpq/md_2exp.c	Fri Feb 24 11:14:11 2012 +0100
+++ b/mpq/md_2exp.c	Fri Feb 24 11:27:02 2012 +0100
@@ -48,8 +48,7 @@
 
   /* no realloc here if rsrc==rdst, so p and rsrc_ptr remain valid */
   len -= (p - rsrc_ptr);
-  MPZ_REALLOC (rdst, len);
-  rdst_ptr = PTR(rdst);
+  rdst_ptr = MPZ_REALLOC (rdst, len);
 
   if ((plow & 1) || n == 0)
     {
diff -r 0890e16b792f -r 142b66e668b7 mpq/set_d.c
--- a/mpq/set_d.c	Fri Feb 24 11:14:11 2012 +0100
+++ b/mpq/set_d.c	Fri Feb 24 11:27:02 2012 +0100
@@ -71,8 +71,7 @@
 	}
 
       dn = -exp;
-      MPZ_REALLOC (NUM(dest), 3);
-      np = PTR(NUM(dest));
+      np = MPZ_REALLOC (NUM(dest), 3);
 #if LIMBS_PER_DOUBLE == 4
       if ((tp[0] | tp[1] | tp[2]) == 0)
 	np[0] = tp[3], nn = 1;
diff -r 0890e16b792f -r 142b66e668b7 mpq/set_f.c
--- a/mpq/set_f.c	Fri Feb 24 11:14:11 2012 +0100
+++ b/mpq/set_f.c	Fri Feb 24 11:27:02 2012 +0100
@@ -49,8 +49,7 @@
       /* radix point is to the right of the limbs, no denominator */
       mp_ptr  num_ptr;
 
-      MPZ_REALLOC (mpq_numref (q), fexp);
-      num_ptr = PTR(NUM(q));
+      num_ptr = MPZ_REALLOC (mpq_numref (q), fexp);
       MPN_ZERO (num_ptr, fexp - abs_fsize);
       MPN_COPY (num_ptr + fexp - abs_fsize, fptr, abs_fsize);
 
@@ -65,10 +64,8 @@
       mp_size_t  den_size;
 
       den_size = abs_fsize - fexp;
-      MPZ_REALLOC (mpq_numref (q), abs_fsize);
-      MPZ_REALLOC (mpq_denref (q), den_size+1);
-      num_ptr = PTR(NUM(q));
-      den_ptr = PTR(DEN(q));
+      num_ptr = MPZ_REALLOC (mpq_numref (q), abs_fsize);
+      den_ptr = MPZ_REALLOC (mpq_denref (q), den_size+1);
 
       if (flow & 1)
         {


More information about the gmp-commit mailing list