From 5ce1590355efb611fcba12e243b9a5474bda2288 Mon Sep 17 00:00:00 2001 From: Li-Ta Lo Date: Tue, 11 Jan 2005 16:33:31 +0000 Subject: fixed abs() impelmentation git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1854 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/devices/emulator/x86emu/prim_ops.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/devices/emulator/x86emu') diff --git a/src/devices/emulator/x86emu/prim_ops.c b/src/devices/emulator/x86emu/prim_ops.c index bea5aef481..a707521d49 100644 --- a/src/devices/emulator/x86emu/prim_ops.c +++ b/src/devices/emulator/x86emu/prim_ops.c @@ -99,7 +99,16 @@ #define PRIM_OPS_NO_REDEFINE_ASM #include "x86emui.h" -#define abs(x) (x ? x>0: -x) + +#define abs(x) ({ \ + int __x = (x); \ + (__x < 0) ? -__x : __x; \ + }) + +#define labs(x) ({ \ + long __x = (x); \ + (__x < 0) ? -__x : __x; \ + }) /*------------------------- Global Variables ------------------------------*/ -- cgit v1.2.3