Problem
Power of 2 check and counting set bits.
bool isPow2(int n){
return n > 0 && (n & (n - 1)) == 0;
}
int n = 13, count = 0;
while(n){
count += n & 1;
n >>= 1;
}
// or: __builtin_popcount(13)