使用 32 位算术将 64 位数字相加 [英] Adding 64 bit numbers using 32 bit arithmetic

查看:35
本文介绍了使用 32 位算术将 64 位数字相加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用 32 位算术将两个 64 位数字相加??

How do we add two 64 bit numbers using 32 bit arithmetic??

推荐答案

先添加最低有效字节,保留进位.考虑来自 LSB 的进位,添加最高有效字节:

Add the least significant bytes first, keep the carry. Add the most significant bytes considering the carry from LSBs:

; x86 assembly, Intel syntax
; adds ecx:ebx to edx:eax
add eax, ebx
adc edx, ecx

这篇关于使用 32 位算术将 64 位数字相加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆