Created
January 17, 2011 19:34
-
-
Save nahurst/783325 to your computer and use it in GitHub Desktop.
Bit Hacks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v &= v - 1; // clear the least significant bit set | |
((x ^ y) < 0); // true iff x and y have opposite signs | |
//more here http://graphics.stanford.edu/~seander/bithacks.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment