You are viewing a single comment's thread. Return to all comments →
O(1) Code for 64 bit Population Count
typedef unsigned long long ull; ull popcount(ull b) { b -= (b >> 1) & 0x5555555555555555ULL; b = ((b >> 2) & 0x3333333333333333ULL) + (b & 0x3333333333333333ULL); b = ((b >> 4) + b) & 0x0F0F0F0F0F0F0F0FULL; return (b * 0x0101010101010101ULL) >> 56; }
Seems like cookies are disabled on this browser, please enable them to open this website
Counter game
You are viewing a single comment's thread. Return to all comments →
O(1) Code for 64 bit Population Count