[Gmp-commit] /var/hg/gmp: Fixed allocation for mpn_gcdext cofactor argument.

mercurial at gmplib.org mercurial at gmplib.org
Mon May 9 21:38:07 CEST 2011


details:   /var/hg/gmp/rev/0ec95fc3fe72
changeset: 14179:0ec95fc3fe72
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Mon May 09 21:38:01 2011 +0200
description:
Fixed allocation for mpn_gcdext cofactor argument.

diffstat:

 ChangeLog    |  6 ++++++
 doc/gmp.texi |  7 ++++---
 mpz/gcdext.c |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 50f3d8f175d8 -r 0ec95fc3fe72 ChangeLog
--- a/ChangeLog	Mon May 09 14:12:34 2011 +0200
+++ b/ChangeLog	Mon May 09 21:38:01 2011 +0200
@@ -1,3 +1,9 @@
+2011-05-09  Niels Möller  <nisse at lysator.liu.se>
+
+	* mpz/gcdext.c (mpz_gcdext): Increased sp allocation to bsize+1 limbs.
+	* doc/gmp.texi (mpn_gcdext): Fixed documentation of allocation
+	requirements; one extra limb is still needed for S.
+
 2011-05-09  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/x86/fat/gmp-mparam.h (BMOD_1_TO_MOD_1_THRESHOLD): Define.
diff -r 50f3d8f175d8 -r 0ec95fc3fe72 doc/gmp.texi
--- a/doc/gmp.texi	Mon May 09 14:12:34 2011 +0200
+++ b/doc/gmp.texi	Mon May 09 21:38:01 2011 +0200
@@ -5379,9 +5379,10 @@
 0} if and only if @math{V} divides @math{U} (i.e., @math{G = V}).
 
 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 @var{vn} limbs.
+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 area at
+ at var{gp} should have room for @var{vn} limbs and the area at @var{sp} should
+have room for @math{@var{vn}+1} limbs.
 
 Both source operands are destroyed.
 
diff -r 50f3d8f175d8 -r 0ec95fc3fe72 mpz/gcdext.c
--- a/mpz/gcdext.c	Mon May 09 14:12:34 2011 +0200
+++ b/mpz/gcdext.c	Mon May 09 21:38:01 2011 +0200
@@ -77,7 +77,7 @@
   MPN_COPY (tmp_bp, bp, bsize);
 
   tmp_gp = TMP_ALLOC_LIMBS (bsize);
-  tmp_sp = TMP_ALLOC_LIMBS (bsize);
+  tmp_sp = TMP_ALLOC_LIMBS (bsize + 1);
 
   gsize = mpn_gcdext (tmp_gp, tmp_sp, &tmp_ssize, tmp_ap, asize, tmp_bp, bsize);
 


More information about the gmp-commit mailing list