Thought Bucket: Jim is a genius! x & (M-1) == x % M for all M of the form M = pow(2,y) This is especially handy since you can precompute M-1 meaning that you do a bitwise operation instead of a division operation!