`
SwordAndFlame
  • 浏览: 6615 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

位运算

 
阅读更多

统计1的个数

int count(int x)
{
    int res=0;
    while(x){
        res++;
        x&=x-1;
    }
    return res;
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics