Remainder calculation, constant time for a given divisor d.
Based on โFaster Remainder by Direct Computation: Applications to Compilers and Software Librariesโ
by Daniel Lemire, Owen Kaser, and Nathan Kurz., Fig. 1.
Returns the multiplicative inverse of the argument modulo 2^64. The implementation is based
on Hurchallaโs method for computing the multiplicative inverse modulo a power of two, and
is essentially an optimized Newton iteration.