summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-06-30 15:43:40 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-07-11 16:43:53 +0200
commit7df23077e45e55a6fc15eb99fe2ae439678e37e0 (patch)
tree2cecc5cd1ae73b62ca22a9df52878ee17f05db8a
parent3b1a55e110ab387a8d213581983e20c0a63d7894 (diff)
shared: add MIN3 macro
This is like MIN but evaluates 3 arguments. We already have MAX3, so add the equivalent for MIN.
-rw-r--r--src/shared/macro.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h
index 32cf714857..70c5fb50a7 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -154,6 +154,12 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
_a < _b ? _a : _b; \
})
+#define MIN3(x,y,z) \
+ __extension__ ({ \
+ typeof(x) _c = MIN(x,y); \
+ MIN(_c, z); \
+ })
+
#define LESS_BY(A,B) \
__extension__ ({ \
typeof(A) _A = (A); \