[Gmp-commit] /var/hg/gmp: mpn_gcdext no longer needs an extra limb on inputs....

mercurial at gmplib.org mercurial at gmplib.org
Mon May 2 10:57:00 CEST 2011


details:   /var/hg/gmp/rev/6ca070658cd1
changeset: 14156:6ca070658cd1
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Mon May 02 10:56:57 2011 +0200
description:
mpn_gcdext no longer needs an extra limb on inputs. Tweak doc and mpz_gcdext acccordingly.

diffstat:

 ChangeLog    |   7 +++++++
 doc/gmp.texi |   8 +++-----
 mpz/gcdext.c |  12 ++++++------
 3 files changed, 16 insertions(+), 11 deletions(-)

diffs (68 lines):

diff -r d4470f527257 -r 6ca070658cd1 ChangeLog
--- a/ChangeLog	Mon May 02 06:46:28 2011 +0200
+++ b/ChangeLog	Mon May 02 10:56:57 2011 +0200
@@ -1,3 +1,10 @@
+2011-05-02  Niels Möller  <nisse at lysator.liu.se>
+
+	* mpz/gcdext.c (mpz_gcdext): Don't allocate extra limbs at the end
+	of mpn_gcdext parameters.
+
+	* doc/gmp.texi (mpn_gcdext): Updated doc.
+
 2011-05-01  Niels Möller  <nisse at lysator.liu.se>
 
 	* mpn/generic/div_qr_2u_pi1.c (mpn_div_qr_2u_pi1): Fixed ASSERT.
diff -r d4470f527257 -r 6ca070658cd1 doc/gmp.texi
--- a/doc/gmp.texi	Mon May 02 06:46:28 2011 +0200
+++ b/doc/gmp.texi	Mon May 02 10:56:57 2011 +0200
@@ -5381,11 +5381,9 @@
 Store @math{G} at @var{gp} and let the return value define its limb count.
 Store @math{S} at @var{sp} and let |*@var{sn}| define its limb count.  @math{S}
 can be negative; when this happens *@var{sn} will be negative.  The areas at
- at var{gp} and @var{sp} should each have room for @math{@var{xn}+1} limbs.
-
-The areas @{@var{xp}, @math{@var{xn}+1}@} and @{@var{yp}, @math{@var{yn}+1}@}
-are destroyed (i.e.@: the input operands plus an extra limb past the end of
-each).
+ at var{gp} and @var{sp} should each have room for @var{xn} limbs.
+
+Both source operands are destroyed.
 
 Compatibility note: GMP 4.3.0 and 4.3.1 defined @math{S} less strictly.
 Earlier as well as later GMP releases define @math{S} as described here.
diff -r d4470f527257 -r 6ca070658cd1 mpz/gcdext.c
--- a/mpz/gcdext.c	Mon May 02 06:46:28 2011 +0200
+++ b/mpz/gcdext.c	Mon May 02 10:56:57 2011 +0200
@@ -50,8 +50,8 @@
     {
       usize = asize;
       vsize = bsize;
-      up = TMP_ALLOC_LIMBS (usize + 1);
-      vp = TMP_ALLOC_LIMBS (vsize + 1);
+      up = TMP_ALLOC_LIMBS (usize);
+      vp = TMP_ALLOC_LIMBS (vsize);
       MPN_COPY (up, ap, usize);
       MPN_COPY (vp, bp, vsize);
       u = a;
@@ -63,8 +63,8 @@
     {
       usize = bsize;
       vsize = asize;
-      up = TMP_ALLOC_LIMBS (usize + 1);
-      vp = TMP_ALLOC_LIMBS (vsize + 1);
+      up = TMP_ALLOC_LIMBS (usize);
+      vp = TMP_ALLOC_LIMBS (vsize);
       MPN_COPY (up, bp, usize);
       MPN_COPY (vp, ap, vsize);
       u = b;
@@ -73,8 +73,8 @@
       tt = s;
     }
 
-  tmp_gp = TMP_ALLOC_LIMBS (usize + 1);
-  tmp_sp = TMP_ALLOC_LIMBS (usize + 1);
+  tmp_gp = TMP_ALLOC_LIMBS (usize);
+  tmp_sp = TMP_ALLOC_LIMBS (usize);
 
   if (vsize == 0)
     {


More information about the gmp-commit mailing list