当前位置:网站首页>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
边栏推荐
- csdn bug8:待加
- Coding style: SSM environment in MVC mode, code hierarchical management
- Thinking about competitive programming: myths and shocking facts
- csdn bug9:待加
- csdn bug6:待加
- csdn bug10:待加
- One image can hold 16x16 words! ——Transformers for large scale image scaling recognition (a brief review of ICLR 2021 papers)
- 异常:Invalid or unexpected token
- z-index属性详解
- [paper reading notes] a multilayered informational random walk for attributed social network embedding
猜你喜欢
消防知识线上答题活动小程序复盘
竞争性编程的思考:那些神话和令人震惊的事实[图]
一幅图像能顶16x16字!——用于大规模图像缩放识别的变压器(对ICLR 2021年论文的简要回顾)
Raspberry pie drum set WiFi
Simple use of JMeter
Factory approach model
Solution of MAC terminal iterm2 supporting RZ and sz
Bifrost 位点管理 之 异构中间件实现难点(1)
《Python Cookbook 3rd》笔记(2.2):字符串开头或结尾匹配
[Python learning manual notes] 001. Preface to Python
随机推荐
CSDN bug7: to be added
C / C + + Programming Notes: C language development tank war! In memory of our lost little overlord game
CSDN bug11: to be added
Oschina: my green plants are potatoes, ginger and garlic
一幅图像能顶16x16字!——用于大规模图像缩放识别的变压器(对ICLR 2021年论文的简要回顾)
CUDA_ constant memory
The length of the last word in leetcode
Self writing performance testing tool (2)
[leetcode] 92 integer inversion
Fire knowledge online answer activity small program
利用尾巴作为时间序列进行处理来识别鲸鱼
分布式文档存储数据库之MongoDB索引管理
关于centos启动报错:Failed to start Crash recovery kernel arming的解决方案
[论文阅读笔记] Large-Scale Heterogeneous Feature Embedding
Bifrost 位点管理 之 异构中间件实现难点(1)
Promote China manufacturing upgrade, 3D visualization of production line in automobile assembly workshop
delete、truncate、drop 有什么区别,误删数据怎么办
Youtube订阅——解决在弹窗内使用Youtube订阅按钮高度显示不全的问题
Wu Enda's refining notes on machine learning 4: basis of neural network - Zhihu
自己上手写性能测试工具(二)