JE / JNE和JZ / JNZ之间的区别 [英] Difference between JE/JNE and 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屋!