JE / JNE和JZ / JNZ之间的区别 [英] Difference between JE/JNE and JZ/JNZ

查看:3432
本文介绍了JE / JNE和JZ / JNZ之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在x86汇编code,是 JE JNE 完全一样的 JZ JNZ

In x86 assembly code, are JE and JNE exactly the same as JZ and JNZ?

推荐答案

JE JZ 只是名称不同对于同样的事情:一个
有条件跳的时候 ZF (零标志)等于1。

JE and JZ are just different names for exactly the same thing: a conditional jump when ZF (the "zero" flag) is equal to 1.

(同样, JNE JNZ 是条件跳转只是叫法不同
ZF 等于0)。

(Similarly, JNE and JNZ are just different names for a conditional jump when ZF is equal to 0.)

您的可能的交替使用它们,但你的的他们因使用
你在做什么:

You could use them interchangeably, but you should use them depending on what you are doing:


  • JZ / JNZ 是比较合适的,当你明确地测试
    的东西等于零:

  • JZ/JNZ are more appropriate when you are explicitly testing for something being equal to zero:

dec  ecx
jz   counter_is_now_zero


  • JE JNE A 之后,是比较合适的CMP 指令:

    cmp  edx, 42
    je   the_answer_is_42
    

    (A CMP 指令执行减法,并抛出结果的价值远,同时保持标志,这就是为什么你会得到 ZF = 1 当操作数相等
    ZF = 0 时,他们不是。)

    (A CMP instruction performs a subtraction, and throws the value of the result away, while keeping the flags; which is why you get ZF=1 when the operands are equal and ZF=0 when they're not.)

    这篇关于JE / JNE和JZ / JNZ之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆