当前位置:网站首页>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
边栏推荐
- CUDA_ Host memory
- csdn bug11:待加
- Exception: invalid or unexpected token
- csdn bug8:待加
- Self writing performance testing tool (2)
- Network security engineer Demo: original * * controls your server like this! (2)
- Solution of MAC terminal iterm2 supporting RZ and sz
- 史上最全异常检测算法概述
- Assign the corresponding key and value in the map to the object
- CUDA_ Shared memory, memory access mechanism, access optimization
猜你喜欢

Promote China manufacturing upgrade, 3D visualization of production line in automobile assembly workshop

消防知识线上答题活动小程序复盘
![[paper reading notes] a multilayered informational random walk for attributed social network embedding](/img/3d/657a60600219ce6cfc514ad1b1bb49.jpg)
[paper reading notes] a multilayered informational random walk for attributed social network embedding

JS solves the problem of automatic pagination in browser printing

csdn bug3:待加

iNeuOS工业互联平台,WEB组态(iNeuView)增加工程视图导入、导出功能,及优化和修复,发布:v3.2.1版本

csdn bug7:待加

Learning from scratch YoMo series: Opening

JMeter的简单使用

史上最全异常检测算法概述
随机推荐
Problems and solutions in configuring FTP server with FileZilla server
Centos7 operating system security hardening series (2)
吴恩达《Machine Learning》精炼笔记 4:神经网络基础 - 知乎
For programmers, those unfamiliar and familiar computer hardware
Only options request is sent, no post solution is sent
YouTube subscription: solve the problem of incomplete height display of YouTube subscription button in pop-up window
iNeuOS工业互联平台,WEB组态(iNeuView)增加工程视图导入、导出功能,及优化和修复,发布:v3.2.1版本
史上最全异常检测算法概述
jmeter接口测试--带有token的解决方法
csdn bug4:待加
Coding style: SSM environment in MVC mode, code hierarchical management
[论文阅读笔记] Network Embedding with Attribute Refinement
Coding style: SSM environment in MVC mode, code hierarchical management
[论文阅读笔记] Community-oriented attributed network embedding
Explanation of Z-index attribute
Graph undirected graph
CSDN bug6: to be added
js解决浏览器打印自动分页的问题
OSChina 周二乱弹 —— 我养的绿植分别为土豆,生姜,蒜
图-无向图