Skip to content

Instantly share code, notes, and snippets.

@nahurst
Created January 17, 2011 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nahurst/783325 to your computer and use it in GitHub Desktop.
Save nahurst/783325 to your computer and use it in GitHub Desktop.
Bit Hacks
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