5 lines
102 B
C
5 lines
102 B
C
int popcount(unsigned long x) {
|
|
int n = 0;
|
|
while (x) { n += x & 1; x >>= 1; }
|
|
return n;
|
|
}
|