mpn_gcd documentation [Was: Replacing gcd_1 with gcd_11]

Marco Bodrato bodrato at mail.dm.unipi.it
Sun Aug 18 10:53:33 UTC 2019


Ciao,

Il Dom, 18 Agosto 2019 9:44 am, Niels Möller ha scritto:
> Do we have all needed gcd_11 so we can switch to using it, without
> performance regressions?

I glanced at mpn/generic/gcd.c

The initial comment says:
/* mpn/gcd.c: mpn_gcd for gcd of two odd integers.

A comment inside slightly relaxes the conditions with:
  /* Due to the calling convention for mpn_gcd, at most one can be
     even. */

...but I can not find any documented restriction (odd/even) in the manual.

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 think we should also update the manual to correctly describe the
supported calling convention.


Ĝis,
m

-- 
http://bodrato.it/papers/



More information about the gmp-devel mailing list