司和使用单DIVL指令模量(I386,AMD64) [英] Division and modulus using single divl instruction (i386, amd64)

查看:178
本文介绍了司和使用单DIVL指令模量(I386,AMD64)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图想出内联汇编gcc的获得既有分工和模量使用单 DIVL 指令。不幸的是,我并不擅长组装。可能有人请帮助我在这?谢谢你。

I was trying to come up with inline assembly for gcc to get both division and modulus using single divl instruction. Unfortunately, I am not that good at assembly. Could someone please help me on this? Thank you.

推荐答案

是 - 一个DIVL会产生eax中商和中EDX余数。使用Intel语法,例如:

Yes -- a divl will produce the quotient in eax and the remainder in edx. Using Intel syntax, for example:

mov eax, 17
mov ebx, 3
xor edx, edx
div ebx
; eax = 5
; edx = 2

这篇关于司和使用单DIVL指令模量(I386,AMD64)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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