x86汇编ABS()实现? [英] x86 assembly abs() implementation?

查看:601
本文介绍了x86汇编ABS()实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要得到的2符号整数的差异。是否有x86汇编语言的ABS()函数,这样我就可以做到这一点。任何帮助将大大AP preciated。

I need to get the difference of 2 signed integers. Is there an ABS() function in x86 assembly language so I can do this. Any help would be greatly appreciated.

推荐答案

如果是x86汇编,下面的根据曾经有用的维基百科应该工作。从另一个减去一个值,然后使用在结果上这些指令:

If it is x86 assembly, the following according to the ever useful wikipedia should work. Subtract one value from the other and then use these instructions on the result:

cdq
xor eax, edx
sub eax, edx

这篇关于x86汇编ABS()实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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