int fun(unsigned int a)
{
int count = 0;
while (a)
{
a = a & (a-1);
count++;
}
return count;
}
统计无符号整数比特位为1的数量
最新推荐文章于 2022-11-16 22:27:44 发布
int fun(unsigned int a)
{
int count = 0;
while (a)
{
a = a & (a-1);
count++;
}
return count;
}