size_t CountOne(int num)
{
size_t
count = 0;
while (num)
{
++count;
num &= (num - 1);
}
return
count;
}
size_t count_one(unsigned int x)
{
size_t count = 0;
while(x)
{
count +=
(x&1);
x >>= 1;
}
return count;
}
Copyright 2011-2020 © MallocFree. All rights reserved.