摘要: 1、统计一个无符号整数的二进制表示中1的个数,函数原型是int countbit(unsigned int x);。/*Count the number of 1-bits in a positive number.**By LYLtim*/int CountBit(unsigned x){ x = (x & 0x55555555) + ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x & 0x0F0F0F0F) + (( 阅读全文
posted @ 2011-11-10 11:14 LYLtim 阅读(423) 评论(0) 推荐(0) 编辑