您的位置:首页 > 其它

求两个数的不同位有多少个

2016-08-30 16:29 267 查看
int countBitDiff(int m, int n) {
int c;
c = m^n;
int count = 0;
while(c>0)
{
if(c%2==1)
count++;
c=c>>1;
}
return count;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐