chfast / intx

Extended precision integer C++ library
Apache License 2.0
129 stars 29 forks source link

Apply "Small Quotient Division" optimization #291

Open chfast opened 1 year ago

chfast commented 1 year ago

If you consider 256x256 bit division (i.e. 4-by-4 words division) where division by 1 and 2 words is already fast, the Small Quotient Division should nicely apply to remaining 4-by-4 and 4-by-3 cases.

https://gmplib.org/manual/Small-Quotient-Division

Code comment in GMP: https://gmplib.org/repo/gmp/file/tip/mpn/generic/tdiv_qr.c#l171