摘要:
1. 一个数的从右起第p1位和第p2位swap n位 1 unsigned int swapBits(unsigned int x, unsigned int p1, unsigned int p2, unsigned int n) { 2 unsigned int set1 = (x >> p1) & ((1 > p2) & ((1 > (sizeof(int) * 8 - 1)));3 }also can use division4. count bit set in an integer1 int countsetbits(int x) {2 in 阅读全文