[Gmp-commit] /var/hg/gmp: mpn_gcdext: Added compatibility note on required al...

mercurial at gmplib.org mercurial at gmplib.org
Tue May 3 21:15:04 CEST 2011


details:   /var/hg/gmp/rev/5e68e0e281d5
changeset: 14159:5e68e0e281d5
user:      Niels M?ller <nisse at lysator.liu.se>
date:      Tue May 03 21:14:26 2011 +0200
description:
mpn_gcdext: Added compatibility note on required allocation sizes.
Renamed parameters. Fixed documentation on needed size for gp and sp.

diffstat:

 doc/gmp.texi |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r f4fe07baca0d -r 5e68e0e281d5 doc/gmp.texi
--- a/doc/gmp.texi	Tue May 03 14:38:58 2011 +0200
+++ b/doc/gmp.texi	Tue May 03 21:14:26 2011 +0200
@@ -5365,9 +5365,9 @@
 Both operands must be non-zero.
 @end deftypefun
 
- at deftypefun mp_size_t mpn_gcdext (mp_limb_t *@var{gp}, mp_limb_t *@var{sp}, mp_size_t *@var{sn}, mp_limb_t *@var{xp}, mp_size_t @var{xn}, mp_limb_t *@var{yp}, mp_size_t @var{yn})
-Let @m{U, at var{U}} be defined by @{@var{xp}, @var{xn}@} and let @m{V, at var{V}} be
-defined by @{@var{yp}, @var{yn}@}.
+ at deftypefun mp_size_t mpn_gcdext (mp_limb_t *@var{gp}, mp_limb_t *@var{sp}, mp_size_t *@var{sn}, mp_limb_t *@var{up}, mp_size_t @var{un}, mp_limb_t *@var{vp}, mp_size_t @var{vn})
+Let @m{U, at var{U}} be defined by @{@var{up}, @var{un}@} and let @m{V, at var{V}} be
+defined by @{@var{vp}, @var{vn}@}.
 
 Compute the greatest common divisor @math{G} of @math{U} and @math{V}.  Compute
 a cofactor @math{S} such that @math{G = US + VT}.  The second cofactor @var{T}
@@ -5381,12 +5381,18 @@
 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{xn} limbs.
+ at var{gp} and @var{sp} should each have room for @var{vn} limbs.
 
 Both source operands are destroyed.
 
-Compatibility note: GMP 4.3.0 and 4.3.1 defined @math{S} less strictly.
+Compatibility notes: 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.
+GMP releases before GMP 4.3.0 required allocation of an extra limb for both
+input and output areas. More precisely, the areas
+@{@var{up}, @math{@var{un}+1}@} and @{@var{vp}, @math{@var{vn}+1}@} were
+destroyed, and the areas pointed to by
+ at var{gp} and @var{sp} should each have room for @math{@var{vn}+1} limbs.
+
 @end deftypefun
 
 @deftypefun mp_size_t mpn_sqrtrem (mp_limb_t *@var{r1p}, mp_limb_t *@var{r2p}, const mp_limb_t *@var{sp}, mp_size_t @var{n})


More information about the gmp-commit mailing list