projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3b1a55e
)
shared: add MIN3 macro
author
David Herrmann
<dh.herrmann@gmail.com>
Mon, 30 Jun 2014 13:43:40 +0000
(15:43 +0200)
committer
David Herrmann
<dh.herrmann@gmail.com>
Fri, 11 Jul 2014 14:43:53 +0000
(16:43 +0200)
This is like MIN but evaluates 3 arguments. We already have MAX3, so add
the equivalent for MIN.
src/shared/macro.h
patch
|
blob
|
history
diff --git
a/src/shared/macro.h
b/src/shared/macro.h
index
32cf714
..
70c5fb5
100644
(file)
--- 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); \