读书人

求两个数之和的绝对值,该怎么处理

发布时间: 2012-03-13 11:21:12 作者: rapoo

求两个数之和的绝对值
我是初手,请大家帮我作这道题。thanks!
求两个数之和的绝对值

[解决办法]
#define sumabs(a,b) (a+b>0?a+b:-a-b)
[解决办法]
看错版面了

原型:unsigned int __stdcall sumabs(int x,int y)


sumabs:
mov eax,[esp+4]
add eax,[esp+8]
cmp eax,0
jg @f
neg eax
@@:
ret 8
[解决办法]

Assembly code
example:        mov ax,-3        mov bx,2        add ax,bx        cmp ax,0        jl abs        jmp dispabs:        neg axdisp: 

读书人网 >汇编语言

热点推荐