From 2dc346dfd6a74f8976ce6cb81b72b66928acb246 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 4 Jun 2012 19:41:49 +0200 Subject: [PATCH] base/stdlib.h: abs/labs --- software/include/base/stdlib.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/software/include/base/stdlib.h b/software/include/base/stdlib.h index 7edfac63d..2906720c3 100644 --- a/software/include/base/stdlib.h +++ b/software/include/base/stdlib.h @@ -32,7 +32,15 @@ #define likely(x) x #define unlikely(x) x -#define abs(x) ((x) > 0 ? (x) : -(x)) +static inline int abs(int x) +{ + return x > 0 ? x : -x; +} + +static inline long int labs(long int x) +{ + return x > 0 ? x : -x; +} unsigned long strtoul(const char *nptr, char **endptr, int base); int skip_atoi(const char **s);