mpz_gcd_ext(NULL, ...)

Torbjörn Granlund tg at gmplib.org
Fri Nov 25 15:41:38 UTC 2016


nisse at lysator.liu.se (Niels Möller) writes:

  tg at gmplib.org (Torbjörn Granlund) writes:
  
  > I suppose it also implies a slight computation overhead
  > to check size + low limb for the return value.
  
  Slight enough to be reasonably for the mpz-layer, I think. 
  
Yep, something akin to

  return gp[0] | gn;

should do, since we can surely assume gp[0] is valid.

  One could consider doing that only when the gcd pointer is NULL, and
  otherwise return some arbitrary value. But that's not a pretty
  interface to document...
  
For mpn I think such neat interfaces are conceivable, but not great.


-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list