3 ms·
Yes, if you know something is an exact multiple of n = r*2^k where r is odd, you can divide out the multiple by right-shifting k followed by modular multiplicat
by orlp 2y ago
Yes, if you know something is an exact multiple of n = r*2^k where r is odd, you can divide out the multiple by right-shifting k followed by modular multiplication by the modular multiplicative inverse of r.
- thaumasiotes 2y agoTheoretically, you could also take advantage of two's complement arithmetic: 00011011 (27) x 01010101 (-0.333...) ------------------------ 11110111 (-9) invert and add one: 00001001 (9, like we wanted) I'd be interested in extending this to non-exact multiples, but if that's possible I don't know how.