- UID
- 2198
注册时间2005-6-29
阅读权限255
最后登录1970-1-1
副坛主
该用户从未签到
|
楼主 |
发表于 2010-3-23 03:10:45
|
显示全部楼层
还有 break; continue;
if() 条件的逻辑与 非 之间的关系
///////////////////////////////////////////////////
for (int i = 0; i < 100 ; i++)
{
if(i % 3 == 0)
break;
if(i % 5 == 1)
continue;
if(i % 7 == 9)
goto Here;
}
Here:
/////////////////////////////////////////////////
41: for (int i = 0; i < 100 ; i++)
0040D446 mov dword ptr [ebp-10h],0
0040D44D jmp main+38h (0040d458)
0040D44F mov eax,dword ptr [ebp-10h]
0040D452 add eax,1
0040D455 mov dword ptr [ebp-10h],eax
0040D458 cmp dword ptr [ebp-10h],64h
0040D45C jge Here (0040d498)
42: {
43: if(i % 3 == 0)
0040D45E mov eax,dword ptr [ebp-10h]
0040D461 cdq
0040D462 mov ecx,3
0040D467 idiv eax,ecx
0040D469 test edx,edx
0040D46B jne main+4Fh (0040d46f)
44: break;
0040D46D jmp Here (0040d498)
45: if(i % 5 == 1)
0040D46F mov eax,dword ptr [ebp-10h]
0040D472 cdq
0040D473 mov ecx,5
0040D478 idiv eax,ecx
0040D47A cmp edx,1
0040D47D jne main+61h (0040d481)
46: continue;
0040D47F jmp main+2Fh (0040d44f)
47: if(i % 7 == 9)
0040D481 mov eax,dword ptr [ebp-10h]
0040D484 cdq
0040D485 mov ecx,7
0040D48A idiv eax,ecx
0040D48C cmp edx,9
0040D48F jne main+76h (0040d496)
48: goto Here;
0040D491 jmp Here+0D9h (0040d571)
49: }
0040D496 jmp main+2Fh (0040d44f)
50: Here:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
break; jmp over
continue; jmp 条件指令处
goto 先跳到末尾 然后再通过另一个JMP返回
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
00401000 /$ 56 PUSH ESI
00401001 |. 57 PUSH EDI
00401002 |. 33C9 XOR ECX,ECX
00401004 |. BE 01000000 MOV ESI,1
00401009 |> 8BC1 /MOV EAX,ECX
0040100B |. BF 03000000 |MOV EDI,3
00401010 |. 99 |CDQ
00401011 |. F7FF |IDIV EDI
00401013 |. 85D2 |TEST EDX,EDX
00401015 |. 74 23 |JE SHORT esitest.0040103A
00401017 |. 8BC1 |MOV EAX,ECX
00401019 |. BF 05000000 |MOV EDI,5
0040101E |. 99 |CDQ
0040101F |. F7FF |IDIV EDI
00401021 |. 3BD6 |CMP EDX,ESI
00401023 |. 74 0F |JE SHORT esitest.00401034
00401025 |. 8BC1 |MOV EAX,ECX
00401027 |. BF 07000000 |MOV EDI,7
0040102C |. 99 |CDQ
0040102D |. F7FF |IDIV EDI
0040102F |. 83FA 09 |CMP EDX,9
00401032 |. 74 06 |JE SHORT esitest.0040103A
00401034 |> 41 |INC ECX
00401035 |. 83F9 64 |CMP ECX,64
00401038 |.^ 7C CF \JL SHORT esitest.00401009 |
|