当前位置:网站首页>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
边栏推荐
- 利用尾巴作为时间序列进行处理来识别鲸鱼
- The length of the last word in leetcode
- mac终端Iterm2支持rz和sz的解决方案
- 使用call、apply和bind解决js中烦人的this,事件绑定时的this和传参问题
- 从零开始学习 YoMo 系列教程:开篇
- [论文阅读笔记] Community-oriented attributed network embedding
- CSDN BUG1: to be added
- Network security engineer Demo: original * * controls your server like this! (2)
- 浅谈字节最新开源联邦机器学习平台Fedlearner
- CUDA_ Get the specified device
猜你喜欢

If you need a million objects

An unsafe class named unsafe

Gets the property value of a column in the list collection object

Seam engraving algorithm: a seemingly impossible image size adjustment method

C++ exception implementation mechanism

安卓快速关机APP

一幅图像能顶16x16字!——用于大规模图像缩放识别的变压器(对ICLR 2021年论文的简要回顾)

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

Overview of the most complete anomaly detection algorithm in history

《Python Cookbook 3rd》笔记(2.1):使用多个界定符分割字符串
随机推荐
day85:luffy:购物车根据有效期不同切换价格&购物车删除操作&价格结算&订单页面前戏
leetcode之最后一个单词的长度
Filezilla server配置FTP服务器中的各种问题与解决方法
After seven years of pursuing, nearly one billion US dollars of bitcoin was eventually confiscated and confiscated by the US government
JMeter的简单使用
编码风格:Mvc模式下SSM环境,代码分层管理
Explanation of Z-index attribute
Wu Enda's refining notes on machine learning 4: basis of neural network - Zhihu
Bifrost 位点管理 之 异构中间件实现难点(1)
C++ exception implementation mechanism
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
Using tail as time series to identify whales
极验无感验证破解
lodash.js源码-flatten
《Python Cookbook 3rd》笔记(2.2):字符串开头或结尾匹配
csdn bug11:待加
Centos7 operating system security hardening series (2)
Detach ()
推动中国制造升级,汽车装配车间生产流水线 3D 可视化
csdn bug1:待加