当前位置:网站首页>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
- Solution of MAC terminal iterm2 supporting RZ and sz
- 获取List集合对象中某一列属性值
- 《Python Cookbook 3rd》笔记(2.1):使用多个界定符分割字符串
- csdn bug11:待加
- Assign the corresponding key and value in the map to the object
- [python学习手册-笔记]001.python前言
- z-index属性详解
- Wu Enda's refining notes on machine learning 4: basis of neural network - Zhihu
- Incomplete Polyfill of proxy
猜你喜欢
获取List集合对象中某一列属性值
YouTube subscription: solve the problem of incomplete height display of YouTube subscription button in pop-up window
csdn bug11:待加
利用尾巴作为时间序列进行处理来识别鲸鱼
jt-day10
Thinking about competitive programming: myths and shocking facts
[paper reading notes] rosane, robust and scalable attributed network embedding for sparse networks
Overview of the most complete anomaly detection algorithm in history
Incomplete Polyfill of proxy
【LeetCode】 93 平衡二叉树
随机推荐
Overview of the most complete anomaly detection algorithm in history
leetcode之最后一个单词的长度
csdn bug11:待加
leetcode之最后一个单词的长度
使用call、apply和bind解决js中烦人的this,事件绑定时的this和传参问题
Unity使用transform.Rotate进行三维旋转角度出现偏差
接缝雕刻算法:一种看似不可能的图像大小调整方法
异常:Invalid or unexpected token
An unsafe class named unsafe
Commodity management - merge purchase demand into purchase order
CSDN bug3: to be added
Mongodb index management of distributed document storage database
Assign the corresponding key and value in the map to the object
Coding style: SSM environment in MVC mode, code hierarchical management
CUDA_ Shared memory, memory access mechanism, access optimization
CSDN bug7: to be added
Yixian e-commerce prospectus of perfect diary parent company: focusing on marketing and ignoring R & D, with a loss of 1.1 billion in the first three quarters
For programmers, those unfamiliar and familiar computer hardware
仅发送options请求,没有发送post解决方案
Using tail as time series to identify whales