当前位置:网站首页>gnu汇编-基本数学方程-乘法
gnu汇编-基本数学方程-乘法
2020-11-10 08:45:00 【osc_uie90flw】
文章目录
简介
乘法运算是整数运算中很重要的一种运算。和加法和减法运算不一样的是,乘法运算对于有符号整数和无符号整数运算符是不一样的。
使用mul进行无符号运算
MUL命令用于将两个无符号的整数相乘。MUL乘法如下所示:
mul source
其中source可以是8位的,也可以是16位的,也可以是32位的。
这里source是被乘数,而乘数的值来源于EAX寄存器。
实例:
.code32
.section .data
data1:
.int 10
data2:
.int 20
answer:
.quad 0
output:
.asciz "The result is %qd\n"
.section .text
.globl _start
_start:
nop
movl data1,%eax
mull data2
movl %eax, answer
movl %edx,answer+4
pushl %edx
pushl %eax
pushl $output
call printf
add $12,%esp
pushl $0
call exit
as -o multest.o multest.s -gstabs --32
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o multest -L/lib -lc multest.o
结果最终放在了EDX和EAX组合起来的8字节内容,其中EDX是存放结果的高位,EAX存放结果的低位。
使用imul进行有符号运算
版权声明
本文为[osc_uie90flw]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4274857/blog/4710496
边栏推荐
- Bifrost 位点管理 之 异构中间件实现难点(1)
- 一个名为不安全的类Unsafe
- 接缝雕刻算法:一种看似不可能的图像大小调整方法
- 关于centos启动报错:Failed to start Crash recovery kernel arming的解决方案
- Simple use of JMeter
- 【LeetCode】 93 平衡二叉树
- [论文阅读笔记] Large-Scale Heterogeneous Feature Embedding
- “wget: 无法解析主机地址”的解决方法
- 利用尾巴作为时间序列进行处理来识别鲸鱼
- Commodity management - merge purchase demand into purchase order
猜你喜欢

图-无向图

从零开始学习 YoMo 系列教程:开篇

Bifrost 位点管理 之 异构中间件实现难点(1)

Problems and solutions in configuring FTP server with FileZilla server

C++异常实现机制

Ineuos industrial interconnection platform, web configuration (ineuview) increases the function of importing and exporting engineering views, as well as optimization and repair. Release: v3.2.1

Youtube订阅——解决在弹窗内使用Youtube订阅按钮高度显示不全的问题

初级工程师如何在职场生存

Commodity management - merge purchase demand into purchase order

One image can hold 16x16 words! ——Transformers for large scale image scaling recognition (a brief review of ICLR 2021 papers)
随机推荐
港股上市公司移卡收购创信众42.5%股权 谋划加快营销服务布局
【LeetCode】 92 整数反转
[论文阅读笔记] RoSANE, Robust and scalable attributed network embedding for sparse networks
Network security engineer Demo: original * * controls your server like this! (2)
【LeetCode】 93 平衡二叉树
Graph undirected graph
Several solutions to the problem that selenium webdriver always fails to use click
对于程序员,那些既陌生又熟悉的计算机硬件
[论文阅读笔记] Community-oriented attributed network embedding
编码风格:Mvc模式下SSM环境,代码分层管理
[paper reading notes] large scale heterogeneous feature embedding
Raspberry pie drum set WiFi
csdn bug8:待加
csdn bug6:待加
吴恩达《Machine Learning》精炼笔记 4:神经网络基础 - 知乎
js label语法跳出多重循环
小度“破圈”提速,IoT迎来新故事
Only options request is sent, no post solution is sent
Thinking about competitive programming: myths and shocking facts
Difficulties in heterogeneous middleware implementation of Bifrost site management (1)