Created
June 17, 2012 00:00
-
-
Save josejuan/2942896 to your computer and use it in GitHub Desktop.
haszero
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
// http://graphics.stanford.edu/~seander/bithacks.html | |
#define haszero(v) (((v) - 0x01010101UL) & ~(v) & 0x80808080UL) | |
// en 4 operaciones indica si un byte de entre todos es 0 | |
// para 64 bits será, lógicamente | |
#define haszero(v) (((v) - 0x0101010101010101UL) & ~(v) & 0x8080808080808080UL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment