/*C程序设计语言(第2版)P41*/ /*bitcount函数:统计x中值为1的二进制位数*/ int bitcount(unsigned x) { int b; for (b = 0; x != 0; x &= x - 1 ) { ++b; } return b; }