diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/include/stdlib.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/firmware/include/stdlib.h b/firmware/include/stdlib.h index 504b59247a..a287889c6a 100644 --- a/firmware/include/stdlib.h +++ b/firmware/include/stdlib.h | |||
@@ -35,7 +35,15 @@ void *realloc(void *, size_t); | |||
35 | void srand(unsigned int seed); | 35 | void srand(unsigned int seed); |
36 | int rand(void); | 36 | int rand(void); |
37 | 37 | ||
38 | #define abs(x) ((x)>0?(x):-(x)) | 38 | #ifndef ABS |
39 | #if defined(__GNUC__) | ||
40 | #define ABS(a) ({typeof (a) ___a = (a); ___a < 0 ? -___a: ___a; }) | ||
41 | #else | ||
42 | #define ABS(a) (((a) < 0) ? -(a) : (a)) | ||
43 | #endif /* __GNUC__ */ | ||
44 | #endif | ||
45 | |||
46 | #define abs(x) (ABS(x)) | ||
39 | #define labs(x) abs(x) | 47 | #define labs(x) abs(x) |
40 | 48 | ||
41 | #ifdef SIMULATOR | 49 | #ifdef SIMULATOR |