Re:Faster remainders when the divisor is a constant: beating...
by IshKebab on Friday February 08, 2019 @04:15PM
(#19118755)
Clever. Is this possible with 64-bit numbers somehow?
[ Parent
| on HN ]
Re:Faster remainders when the divisor is a constant: beating...
by bloomer on Friday February 08, 2019 @07:27PM
(#19119870)
Yes, the paper is general and covers the case for arbitrary bit size. 64-bit would require a 128-bit approximate inverse in general and the multiplication during computing the mod would extend that out another 64-bits. So would require three registers and two more multiplications on x64 I think. Socidont think it gains you anything in the general case. Bit for some divisors it might beat the traditional Granlund-Montgomery-Warren method when you could use a smaller approximate inverse.