summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2011-05-03 21:14:26 +0200
committerNiels Möller <nisse@lysator.liu.se>2011-05-03 21:14:26 +0200
commit98bed8fae847c74758d61151c2a1e052f0a6b05e (patch)
treece1ab8e4de0a280452d01ef49c1ca5e7c333b2ff
parent8f6aa226db6e02d466b6a4ef47c787103bf46b77 (diff)
downloadgmp-98bed8fae847c74758d61151c2a1e052f0a6b05e.tar.gz
mpn_gcdext: Added compatibility note on required allocation sizes.
Renamed parameters. Fixed documentation on needed size for gp and sp.
-rw-r--r--doc/gmp.texi16
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/gmp.texi b/doc/gmp.texi
index 52105ace6..09f778b4b 100644
--- a/doc/gmp.texi
+++ b/doc/gmp.texi
@@ -5365,9 +5365,9 @@ Return the greatest common divisor of @{@var{xp}, @var{xn}@} and @var{ylimb}.
Both operands must be non-zero.
@end deftypefun
-@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,@var{U}} be defined by @{@var{xp}, @var{xn}@} and let @m{V,@var{V}} be
-defined by @{@var{yp}, @var{yn}@}.
+@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,@var{U}} be defined by @{@var{up}, @var{un}@} and let @m{V,@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 @@ 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 @var{xn} limbs.
+@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
+@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})