From: David Herrmann Date: Mon, 30 Jun 2014 13:43:40 +0000 (+0200) Subject: shared: add MIN3 macro X-Git-Tag: v216~654 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=7df23077e45e55a6fc15eb99fe2ae439678e37e0;p=elogind.git shared: add MIN3 macro This is like MIN but evaluates 3 arguments. We already have MAX3, so add the equivalent for MIN. --- diff --git a/src/shared/macro.h b/src/shared/macro.h index 32cf71485..70c5fb50a 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); \