I have minimize cost of calculating modulus in C. say I have a number x and n is the number which will divide x
when n == 65536 (which happens to be 2^16):
m
The bitwise operation only works well if the divisor is of the form 2^n. In the general case, there is no such bit-wise operation.
2^n