gcd_22

Torbjörn Granlund tg at gmplib.org
Wed Aug 28 09:39:12 UTC 2019


Marco Bodrato <bodrato at mail.dm.unipi.it> writes:

  Maybe tail-call?

  When up[0] == 0 but U is not zero and we can not return the
  result... That's an unlikely case, but it means that one of the
  operands gets much smaller than the other. Maybe a special strategy
  can be used in this case? Maybe a division, maybe a 2-adic division,
  or maybe simply a loop that knows that U will be smaller until also V
  will be one (some) limb shorter...

  ...and finally tail-call to the smaller fixed-size asm function?

I think this is a good proposal.

It is not certain that u-v with its new low-order limb zero is smaller
than v.  But it it is not, we can go to the next smaller algorithm
directly, I assume.

Here is what I have now.  Feel free to improve it!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcd-mpn.c
Type: application/octet-stream
Size: 4272 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-devel/attachments/20190828/d8d796f5/attachment.obj>
-------------- next part --------------


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


More information about the gmp-devel mailing list