summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2011-05-02 10:56:57 +0200
committerNiels Möller <nisse@lysator.liu.se>2011-05-02 10:56:57 +0200
commit362fb172c072c1fe94a6b8d96cf92f39c1046e0f (patch)
treef559937c88dafde52c6c78e817bdff35a6df03bc
parenta836f07a22122f9823da4a9f4a14a458f6b3984a (diff)
downloadgmp-362fb172c072c1fe94a6b8d96cf92f39c1046e0f.tar.gz
mpn_gcdext no longer needs an extra limb on inputs. Tweak doc and mpz_gcdext acccordingly.
-rw-r--r--ChangeLog7
-rw-r--r--doc/gmp.texi6
-rw-r--r--mpz/gcdext.c12
3 files changed, 15 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 1cddea69f..48b7ba21e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-05-02 Niels Möller <nisse@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@lysator.liu.se>
* mpn/generic/div_qr_2u_pi1.c (mpn_div_qr_2u_pi1): Fixed ASSERT.
diff --git a/doc/gmp.texi b/doc/gmp.texi
index d23c7f1c3..3ed742b9f 100644
--- a/doc/gmp.texi
+++ b/doc/gmp.texi
@@ -5381,11 +5381,9 @@ is not computed but can easily be obtained from @m{(G - US) / V, (@var{G} -
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
-@var{gp} and @var{sp} should each have room for @math{@var{xn}+1} limbs.
+@var{gp} and @var{sp} should each have room for @var{xn} 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).
+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 --git a/mpz/gcdext.c b/mpz/gcdext.c
index 2419e2fe9..c7038e175 100644
--- a/mpz/gcdext.c
+++ b/mpz/gcdext.c
@@ -50,8 +50,8 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b)
{
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 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b)
{
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 @@ mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b)
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)
{