Created
March 27, 2017 18:04
-
-
Save shumon84/0d00dd5f598995fb30d1c08c8b384ee8 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
int count_bits(int n) | |
{ | |
int sum; | |
sum=(n>>1)&03333333333; | |
sum=n-sum-((sum>>1)&03333333333); | |
sum=((sum+(sum>>3))&0707070707)%077; | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment