Created
August 21, 2014 01:34
-
-
Save naotokui/f70eddddbcb7c96f6a07 to your computer and use it in GitHub Desktop.
check if a number is 2^N
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
if ((num & (num - 1)) == 0){ | |
// num is 2^N | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment