A fast alternative to the modulo reduction

https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/ [lemire.me]

2019-10-06 20:08

Assume that x and N are 32-bit integers, consider the 64-bit product x * N. You have that (x * N) div 2^32 is in the range, and it is a fair map.

source: HN