summaryrefslogtreecommitdiffstats
path: root/include/c.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/c.h')
-rw-r--r--include/c.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/c.h b/include/c.h
index 413366b2e..6615f6fea 100644
--- a/include/c.h
+++ b/include/c.h
@@ -46,4 +46,17 @@
# define FALSE 0
#endif
+
+#define min(x, y) ({ \
+ typeof(x) _min1 = (x); \
+ typeof(y) _min2 = (y); \
+ (void) (&_min1 == &_min2); \
+ _min1 < _min2 ? _min1 : _min2; })
+
+#define max(x, y) ({ \
+ typeof(x) _max1 = (x); \
+ typeof(y) _max2 = (y); \
+ (void) (&_max1 == &_max2); \
+ _max1 > _max2 ? _max1 : _max2; })
+
#endif /* UTIL_LINUX_C_H */