[PATCH 01/10] Add more useful generic macros
Juergen Beisert
jbe at pengutronix.de
Mon Dec 20 10:05:00 EST 2010
Stolen from the Linux kernel.
Signed-off-by: Juergen Beisert <jbe at pengutronix.de>
---
include/common.h | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/include/common.h b/include/common.h
index 1bea10c..35ad7b9 100644
--- a/include/common.h
+++ b/include/common.h
@@ -231,4 +231,14 @@ extern const char version_string[];
} \
)
+#define abs(x) ({ \
+ long __x = (x); \
+ (__x < 0) ? -__x : __x; \
+ })
+
+#define abs64(x) ({ \
+ s64 __x = (x); \
+ (__x < 0) ? -__x : __x; \
+ })
+
#endif /* __COMMON_H_ */
--
1.7.2.3
More information about the barebox
mailing list