sizeof(char)永遠爲1
sizeof的單位爲byte
c++ byte一般爲8位,但是也有c++的實現中byte多於8位的
c++一個字節多少位可以在如下實現中找到 include the header <climits>, then the actual number of bits per byte will be given by the CHAR_BIT macro.
如何判定一個數是2的倍數
inline bool isPowerOf2(int i)
{
return i > 0 && (i & (i - 1)) == 0;
}