• 和求余运算巧妙结合的jns指令


    .text:004A78B1    and eax, 80000001h
    .text:004A78B6    jns short loc_4A78BD
    .text:004A78B8    dec eax
    .text:004A78B9    or eax, 0FFFFFFFEh
    .text:004A78BC    inc eax
    .text:004A78BD
    .text:004A78BD  loc_4A78BD:
    .text:004A78BD    jnz short loc_4A78D9

    当你看到这段代码,它是什么意思呢?

    我曾经在看雪的帖子上看到过相当好的解释,可是现在找不到了,很遗憾

    那么只好自己记录下

    阅读下面代码,你就懂得它的含义

    18:             if(i%2 == 0)
    0041147C 8B 45 F8        mov eax,dword ptr [i]
    0041147F 25 01 00 00 80    and eax,80000001h
    00411484 79 05         jns main+6Bh (41148Bh)
    00411486 48            dec eax
    00411487 83 C8 FE        or eax,0FFFFFFFEh
    0041148A 40            inc eax
    0041148B 85 C0         test eax,eax
    0041148D 75 19         jne main+88h (4114A8h)
    19:             {
    20:
    21:                  count++;
    0041148F A1 9C 90 41 00    mov eax,dword ptr [count]
    00411494 83 C0 01        add eax,1
    00411497 A3 9C 90 41 00      mov dword ptr [count],eax
    22:                sum += count;
    0041149C 8B 45 EC        mov eax,dword ptr [sum]
    0041149F 03 05 9C 90 41 00   add eax,dword ptr [count]
    004114A5 89 45 EC        mov dword ptr [sum],eax
    23:             }
    24:               sum += count;
    004114A8 8B 45 EC        mov eax,dword ptr [sum]
    004114AB 03 05 A0 90 41 00   add eax,dword ptr [count]
    004114B1 89 45 EC        mov dword ptr [sum],eax

  • 相关阅读:
    Java SE
    Java SE
    Java SE
    Java SE
    Vocabulary: dockyard
    Vocabulary: Intercept
    Java SE
    MVG
    相关学习
    相机开发
  • 原文地址:https://www.cnblogs.com/huhu0013/p/3656912.html
Copyright © 2020-2023  润新知