gpt4 book ai didi

assembly - 如何使用 x86 汇编语言将两个 64 位数字相乘?

转载 作者:行者123 更新时间:2023-12-02 09:12:45 28 4
gpt4 key购买 nike

我该怎么办...

  • 两个 64 位数字相乘

  • 两个 16 位十六进制数相乘

...使用汇编语言。

我只能使用寄存器 %eax、%ebx、%ecx、%edx 和堆栈。

编辑:哦,我在 x86 上使用 ATT 语法
EDIT2:不允许反编译成程序集...

最佳答案

使用可能是您的类(class)教科书的内容,Randall Hyde 的“汇编语言的艺术”。

参见4.2.4 - Extended Precision Multiplication

Although an 8x8, 16x16, or 32x32 multiply is usually sufficient, there are times when you may want to multiply larger values together. You will use the x86 single operand MUL and IMUL instructions for extended precision multiplication ..

Probably the most important thing to remember when performing an extended precision multiplication is that you must also perform a multiple precision addition at the same time. Adding up all the partial products requires several additions that will produce the result. The following listing demonstrates the proper way to multiply two 64 bit values on a 32 bit processor ..

(请参阅完整 assembly 列表和插图的链接。)

关于assembly - 如何使用 x86 汇编语言将两个 64 位数字相乘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/87771/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com