aboutsummaryrefslogtreecommitdiff
path: root/src/devices
diff options
context:
space:
mode:
authorLi-Ta Lo <ollie@lanl.gov>2005-01-11 16:33:31 +0000
committerLi-Ta Lo <ollie@lanl.gov>2005-01-11 16:33:31 +0000
commit5ce1590355efb611fcba12e243b9a5474bda2288 (patch)
tree4362c352726488707f938ff478922e18d6a65929 /src/devices
parent8b0356c2c9136493f79d9faddbda1bfac7ca687e (diff)
fixed abs() impelmentation
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1854 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/emulator/x86emu/prim_ops.c11
1 files changed, 10 insertions, 1 deletions
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 ------------------------------*/