Created
May 8, 2016 21:28
-
-
Save ahmadyan/c3203392b3ac8104eb8ec4d47958bfa4 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
size_t count() const | |
{ // count number of set bits | |
static char _Bitsperhex[] = "\0\1\1\2\1\2\2\3\1\2\2\3\2\3\3\4"; | |
size_t _Val = 0; | |
for (int _Wpos = _Words; 0 <= _Wpos; --_Wpos) | |
for (_Ty _Wordval = _Array[_Wpos]; _Wordval != 0; _Wordval >>= 4) | |
_Val += _Bitsperhex[_Wordval & 0xF]; | |
return (_Val); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment