Created
October 6, 2014 14:26
-
-
Save raven38/a390d0a4dee9e50c6a20 to your computer and use it in GitHub Desktop.
最下位ビットを見つけるだけ
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
// 1になってる最下位ビット以下を返す 10010なら10 | |
// 10010 & 01111 から 00010 | |
int lowbit(int x){ | |
return x&-x; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment