summaryrefslogtreecommitdiffstats
path: root/include/common.h
diff options
context:
space:
mode:
authorJuergen Beisert <jbe@pengutronix.de>2010-12-20 16:05:00 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2010-12-21 08:26:08 +0100
commit799b06606b94bf48b7340ad674f9924201d5dc75 (patch)
treebc77e992d6f9359c196aad6c195947c00be4aba9 /include/common.h
parent50352ae9d9ca30081eb6f38a93fb7d6b539bc7ca (diff)
downloadbarebox-799b06606b94bf48b7340ad674f9924201d5dc75.tar.gz
barebox-799b06606b94bf48b7340ad674f9924201d5dc75.tar.xz
Add more useful generic macros
Stolen from the Linux kernel. Signed-off-by: Juergen Beisert <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index 1bea10c05a..35ad7b994d 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_ */