summaryrefslogtreecommitdiff
path: root/src/devices/emulator
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/emulator')
-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 ------------------------------*/