JA和JG在组装方面的区别 [英] Difference between JA and JG in assembly

查看:452
本文介绍了JA和JG在组装方面的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能否告诉我汇编语言中的 JUMP IF JUMP IF GREATER 之间的区别?我什么时候使用它们?他们给我不同的结果吗?

Can you please tell me the difference between JUMP IF ABOVE AND JUMP IF GREATER in Assembly language? when do i use each of them? do they give me different results?

推荐答案

作为英特尔手册进行解释 ,JG会将标志解释为好像已签名,而JA会将标志解释为未签名(当然,如果设置标志的操作不是比较或减法,则可能没有意义).是的,他们是不同的.准确地说,

As Intel's manual explains, JG interprets the flags as though the comparison was signed, and JA interprets the flags as though the comparison was unsigned (of course if the operation that set the flags was not a comparison or subtraction, that may not make sense). So yes, they're different. To be precise,

    如果CF = 0ZF = 0
  • ja会跳转(上面无符号:无进位且不相等)
  • jg如果SF = OFZF = 0(带符号的大写,不包括等号)跳转,则跳转
  • ja jumps if CF = 0 and ZF = 0 (unsigned Above: no carry and not equal)
  • jg jumps if SF = OF and ZF = 0 (signed Greater, excluding equal)

例如,

cmp eax, edx
ja somewhere ; will go "somewhere" if eax >u edx
             ; where >u is "unsigned greater than"

cmp eax, edx
jg somewhere ; will go "somewhere" if eax >s edx
             ; where >s is "signed greater than"

>u>s同意最高位为零的值,但最高位集的值被>s视为负数,而被>u视为大值(当然,如果两个操作数都具有最高位)位设置,>u>s再次一致.

>u and >s agree for values with the top bit zero, but values with the top bit set are treated as negative by >s and as big by >u (of course if both operands have the top bit set, >u and >s agree again).

这篇关于JA和JG在组装方面的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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