Advertisement

Getting the modulus!

Started by May 23, 2001 05:03 AM
0 comments, last by curly01 23 years, 8 months ago
What is the fastest way to get the modulus, given x%y, assuming y is always a power of 2.
and it with the appropriate mask

x%y == x&(y-1);

(this does ONLY work if y is a power of 2)

This topic is closed to new replies.

Advertisement