http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know