Documentation of mpn_gcd and overlap
Marc Glisse
marc.glisse at inria.fr
Sun Jan 13 14:46:08 CET 2013
Hello,
the documentation says:
Function: mp_size_t mpn_gcd (mp_limb_t *rp, mp_limb_t *xp, mp_size_t xn,
mp_limb_t *yp, mp_size_t yn)
Set {rp, retval} to the greatest common divisor of {xp, xn} and {yp,
yn}. The result can be up to yn limbs, the return value is the actual
number produced. Both source operands are destroyed.
It is required that xn >= yn > 0, and the most significant limb of
{yp, yn} must be non-zero. No overlap is permitted between {xp, xn} and
{yp, yn}.
I am surprised at such a no-overlap requirement between the inputs. Is it
meant to forbid overlaps with {rp, *} instead? Or am I missing a reason
why overlap of inputs can cause problems?
--
Marc Glisse
More information about the gmp-bugs
mailing list