{
unsigned long long two16, two48 ;
two16 = 65536;
two48 = two16 * two16 * two16 ;
printf("2^48=%llX \n",two48 );
two48 = 1<<48 ;
printf("Shifted 1<<48=%llX \n",two48);
return 0 ;
}
Run Code Online (Sandbox Code Playgroud)
当在 64 位机器上编译时,字大小为 8,上面给出警告 2=1<<48 将溢出左移计数 >= 类型宽度。
程序的输出是:
2^48=1000000000000
Shifted 1<<48=0
Run Code Online (Sandbox Code Playgroud)
到底是怎么回事?为什么我不能将 64 位数量移至 48 位?