Created
February 17, 2014 10:58
-
-
Save ndzj081221130/9048596 to your computer and use it in GitHub Desktop.
求二进制中1的个数
This file contains hidden or 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
| > Written with [StackEdit](https://stackedit.io/). | |
| 右移,与0x1比较 | |
| 除2,比较余数 | |
| 编程之美p121,解法三 | |
| while(v){ | |
| v &= (v-1); | |
| count++; | |
| } | |
| 空间换时间。 | |
| case语句,0x0---0xff | |
| 查表 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment