summaryrefslogtreecommitdiff
path: root/firmware/include
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include')
-rw-r--r--firmware/include/stdlib.h10
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);
35void srand(unsigned int seed); 35void srand(unsigned int seed);
36int rand(void); 36int 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