64,647
社区成员
发帖
与我相关
我的任务
分享
int i = (2 << 1024);
00401028 mov dword ptr [ebp-4],2
90: printf("%d\n", i);
0040102F mov eax,dword ptr [ebp-4]
00401032 push eax
00401033 push offset string "%d\n" (0042201c)
00401038 call printf (00401090)
0040103D add esp,8
91: i = (i >> 1024);
00401040 mov ecx,dword ptr [ebp-4]
00401043 sar ecx,0
00401046 mov dword ptr [ebp-4],ecx
92: printf("%d\n", i);
00401049 mov edx,dword ptr [ebp-4]
0040104C push edx
0040104D push offset string "%d\n" (0042201c)
00401052 call printf (00401090)
00401057 add esp,8
93:
int i = 2<<1024;
ShowMessage(i);
i= i>>1024;
ShowMessage(i);
//只是警告,结果都是2,why?
[C++ Warning] test.cpp(200): W8055 Possible overflow in shift operation
[C++ Warning] test.cpp(200): W8055 Possible overflow in shift operation
ShowMessage(2<<32>>32);
int i;
i = 1<<1; // 2
i = 1<<30; // 0x40000000
i = 1<<31; // 0x80000000
i = 1<<32;//0
i = 1<<64;//0
i = 1<<65;//0
i = 1<<66;//0
i = 1<<128;//0
i = 1<<129;//0
i = 1<<130;//0
i = 1<<256;//1
i = 1<<257;//2
i = 1<<258;//4
i = 1<<512;//1
i = 1<<513;//2
i = 1<<514;//4
i = 1<<1024;//1
i = 1<<1025;//2
i = 1<<1026;//4