Guest User

Untitled

a guest
Jul 29th, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. How to efficiently calculate a modulus in C by hand?
  2. unsigned int modulus = (a - (INT_FLOOR(a / b) * b) + b) % b;
  3.  
  4. unsigned int modulus = (a - (a & ~(b-1)) + b) & (b-1);
Advertisement
Add Comment
Please, Sign In to add comment