http://blog.csdn.net/qll125596718/article/details/6901935#include <iostream>#include <stdint.h>#include <bitset>using namespace std; int main() { for(uint64_t i=0; i<64; i++){ bitset<64> bs; //uint64_t j = (uint64_t)1 << i; bs.set(i); cout << i << ": " << bs << "," << bs.to_ulong() << endl; } return 0;} 0: 0000000000000000000000000000000000000000000000000000000000000001,11: 0000000000000000000000000000000000000000000000000000000000000010,22: 0000000000000000000000000000000000000000000000000000000000000100,43: 0000000000000000000000000000000000000000000000000000000000001000,84: 0000000000000000000000000000000000000000000000000000000000010000,165: 0000000000000000000000000000000000000000000000000000000000100000,326: 0000000000000000000000000000000000000000000000000000000001000000,647: 0000000000000000000000000000000000000000000000000000000010000000,1288: 0000000000000000000000000000000000000000000000000000000100000000,2569: 0000000000000000000000000000000000000000000000000000001000000000,51210: 0000000000000000000000000000000000000000000000000000010000000000,102411: 0000000000000000000000000000000000000000000000000000100000000000,204812: 0000000000000000000000000000000000000000000000000001000000000000,409613: 0000000000000000000000000000000000000000000000000010000000000000,819214: 0000000000000000000000000000000000000000000000000100000000000000,1638415: 0000000000000000000000000000000000000000000000001000000000000000,3276816: 0000000000000000000000000000000000000000000000010000000000000000,6553617: 0000000000000000000000000000000000000000000000100000000000000000,13107218: 0000000000000000000000000000000000000000000001000000000000000000,26214419: 0000000000000000000000000000000000000000000010000000000000000000,52428820: 0000000000000000000000000000000000000000000100000000000000000000,104857621: 0000000000000000000000000000000000000000001000000000000000000000,209715222: 0000000000000000000000000000000000000000010000000000000000000000,419430423: 0000000000000000000000000000000000000000100000000000000000000000,838860824: 0000000000000000000000000000000000000001000000000000000000000000,1677721625: 0000000000000000000000000000000000000010000000000000000000000000,3355443226: 0000000000000000000000000000000000000100000000000000000000000000,6710886427: 0000000000000000000000000000000000001000000000000000000000000000,13421772828: 0000000000000000000000000000000000010000000000000000000000000000,26843545629: 0000000000000000000000000000000000100000000000000000000000000000,53687091230: 0000000000000000000000000000000001000000000000000000000000000000,107374182431: 0000000000000000000000000000000010000000000000000000000000000000,214748364832: 0000000000000000000000000000000100000000000000000000000000000000,429496729633: 0000000000000000000000000000001000000000000000000000000000000000,858993459234: 0000000000000000000000000000010000000000000000000000000000000000,1717986918435: 0000000000000000000000000000100000000000000000000000000000000000,3435973836836: 0000000000000000000000000001000000000000000000000000000000000000,6871947673637: 0000000000000000000000000010000000000000000000000000000000000000,13743895347238: 0000000000000000000000000100000000000000000000000000000000000000,27487790694439: 0000000000000000000000001000000000000000000000000000000000000000,54975581388840: 0000000000000000000000010000000000000000000000000000000000000000,109951162777641: 0000000000000000000000100000000000000000000000000000000000000000,219902325555242: 0000000000000000000001000000000000000000000000000000000000000000,439804651110443: 0000000000000000000010000000000000000000000000000000000000000000,879609302220844: 0000000000000000000100000000000000000000000000000000000000000000,1759218604441645: 0000000000000000001000000000000000000000000000000000000000000000,3518437208883246: 0000000000000000010000000000000000000000000000000000000000000000,7036874417766447: 0000000000000000100000000000000000000000000000000000000000000000,14073748835532848: 0000000000000001000000000000000000000000000000000000000000000000,28147497671065649: 0000000000000010000000000000000000000000000000000000000000000000,56294995342131250: 0000000000000100000000000000000000000000000000000000000000000000,112589990684262451: 0000000000001000000000000000000000000000000000000000000000000000,225179981368524852: 0000000000010000000000000000000000000000000000000000000000000000,450359962737049653: 0000000000100000000000000000000000000000000000000000000000000000,900719925474099254: 0000000001000000000000000000000000000000000000000000000000000000,1801439850948198455: 0000000010000000000000000000000000000000000000000000000000000000,3602879701896396856: 0000000100000000000000000000000000000000000000000000000000000000,7205759403792793657: 0000001000000000000000000000000000000000000000000000000000000000,14411518807585587258: 0000010000000000000000000000000000000000000000000000000000000000,28823037615171174459: 0000100000000000000000000000000000000000000000000000000000000000,57646075230342348860: 0001000000000000000000000000000000000000000000000000000000000000,115292150460684697661: 0010000000000000000000000000000000000000000000000000000000000000,230584300921369395262: 0100000000000000000000000000000000000000000000000000000000000000,461168601842738790463: 1000000000000000000000000000000000000000000000000000000000000000,9223372036854775808
时间: 2024-10-26 04:41:51