快速判断一个数是否是2的幂
#define is_power_of_2(x) (!((x) & (x - 1)))
已知一个数n,求m,使m >= n,且m是2的幂
unsigned int fixsize(unsigned long size){ if(is_power_of_2(size)) return size; size |= size >> 1; size |= size >> 2; size |= size >> 4; size |= size >> 8; size |= size >> 16; return size + 1; }