Odd or Even Number Trick

Everybody knows the standard technique for testing whether a (positive, whole) number is odd or even; just divide by two and see if the remainder is zero. The mathematic name for this function for the modulo operation. There is an another way to perform the most common use, in which the divisor is 2 -- just do a bitwise compare of the first bit. If it's zero, the number must be even. I assume the bitwise operation is faster, but I guess that depends on the language and implementation.

Instead of (13 % 2), try (13 & 1). Both return a zero or one, and the meaning of the result is the same.