uint64_t a = 0x1234567887654321;
uint64_t b = 1;
int shift;
for(shift = 0; shift < 64; shift++)
b = 1 << shift;
shift = 31
shift = 32
shift = 33
注意:位移操作默認1是32bit的,如要使用64bit需要強制聲明1ULL。
for(shift = 0; shift < 64; shift++)
b = 1ULL << shift;