jle汇编,关于AT& T语法汇编中的cmp / jg,jle等

jle汇编,关于AT& T语法汇编中的cmp / jg,jle等Soeverysingl cmp eax ebxjg something wouldjumpto something ifeaxwasgrea ButIhaveanot something something

jle汇编,关于AT& T语法汇编中的cmp / jg,jle等

So every single resource online tells me that something like this:

cmp %eax, %ebx

jg < something >

would jump to < something > if eax was greater than ebx. But I have another piece of code that seems to contradict this:

cmp $0x2, %eax

jg < something>

as it jumps to < something > when eax has the value 3.

Am I missing something, or does cmp a, b – jg execute if b > a and not a>b? And does this apply to other jump statements as well?

解决方案

When we read something like

cmp $0x2, %eax

jg < something >

we know the assembler used is one that reverses the position of the operands of an instruction. That’s because Intel’s syntax dictates that the destination operand comes before the source operand and clearly an immediate value like $0x2 can’t ever be a destination!

Knowing the order of things we now interpret your first code snippet as

cmp ebx, eax

jg < something > ;jump if EBX > EAX

and the second code snippet as

cmp eax, 2

jg < something > ;jump if EAX > 2

And does this apply to other jump statements as well?

It does.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/201758.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月20日 上午8:41
下一篇 2026年3月20日 上午8:41


相关推荐

  • LinkedHashMap实现原理

    LinkedHashMap实现原理1 LinkedHashMa 概述 nbsp nbsp nbsp nbsp nbsp LinkedHashMa 是 Map 接口的哈希表和链接列表实现 具有可预知的迭代顺序 此实现提供所有可选的映射操作 并允许使用 null 值和 null 键 此类不保证映射的顺序 特别是它不保证该顺序恒久不变 nbsp nbsp nbsp nbsp nbsp LinkedHashMa 实现与 HashMap 的不同之处在于 后者维护着一个运行于所有条目的双重链接列表 此链接列表定义了迭代顺序

    2025年9月26日
    5
  • string.hのstrcat的实现

    string.hのstrcat的实现

    2021年8月23日
    51
  • java的rsa加密算法_用java编程实现RSA加密算法

    java的rsa加密算法_用java编程实现RSA加密算法RSA加密算法是目前应用最广泛的公钥加密算法,特别适用于通过Internet传送的数据,常用于数字签名和密钥交换。那么我今天就给大家介绍一下如何利用Java编程来实现RSA加密算法。一、RSA加密算法描述RSA加密算法是1978年提出的。经过多年的分析和研究,在众多的公开密钥加密算法中,RSA加密算法最受推崇,它也被推荐为公开密钥数据加密标准。由数论知识可知,若将一个具有大素数因子的合数进行分解是…

    2022年5月8日
    303
  • TypeError:Cannot read property ‘get’ ofundefined_typeerror unsupported operand

    TypeError:Cannot read property ‘get’ ofundefined_typeerror unsupported operand1、如果是vue,先看看你的data写对了没,我有一次手误打成了date,检查了一下午才看出来o(╥﹏╥)o2、如果这个数据“xxx”是从后台异步获取的,那就最好在data中先给他个默认值比如,data(){return{obj1:”,obj2:null.obj3:{},obj4:[]}}mounted(){//获取后台数据给obj们赋值等等各种异步操作}或者当“xxx”是一个嵌套两层的

    2022年8月22日
    14
  • python保存两位小数的几种方法,python2保留小数

    python保存两位小数的几种方法,python2保留小数python保存两位小数的几种方法文章目录:一、保留两位小数且做四舍五入处理1、使用字符串格式化2、使用python内置的round()函数3、使用python内置的decimal模块二、保留两位小数且不做四舍五入处理1、使用序列中的切片2、使用re正则匹配模块一、保留两位小数且做四舍五入处理1、使用字符串格式化>>>x=3.1415926>&…

    2022年8月11日
    13
  • 拉屎抽烟定理_为什么抽烟才能拉出屎

    拉屎抽烟定理_为什么抽烟才能拉出屎最近一直在做游戏,刚开始接触游戏,思维还是撞不过来,买了一本书看了看了一下,才开始有了游戏思维,每当写程序感到思维混乱的时候,于是出去抽根烟,什么烦恼随着眼圈飘忽而出,有时抽着抽着突然就有了灵感,于是

    2022年8月3日
    9

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号