Replace mod operations with bitwise AND where possible

This pull request replaces modular operations (%) with bitwise AND operations where used in a hot code path or in a loop. Modulus invokes division in most CPUs, and this is often 1 to 2 orders of magnitude slower than a bitwise AND.

Reflected in several places:

http://dhruba.name/2011/07/12/performance-pattern-modulo-and-powers-of-two/
http://scicomp.stackexchange.com/questions/187/why-is-division-so-much-more-complex-than-other-arithmetic-operations
http://disruptor.googlecode.com/files/Disruptor-1.0.pdf (Page 5, last paragraph)