求unsigned int型数一共有多少bit?
int GetTotalBit(void)
{
unsigned int x = ~0;
int n = 0;
while (x 〉 0) {
n += 8;
x 〉〉= 8;
}
return n;
}
关键就是将0取反,然后移位.