From a8f51c2e2c94387e7dcd95dcb12371b7253847f8 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 18 Feb 2015 17:54:50 +0100 Subject: llmnrd: Add IPv6 support Closes #5 Signed-off-by: Tobias Klauser --- util.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'util.h') diff --git a/util.h b/util.h index 13a8637..d4933c4 100644 --- a/util.h +++ b/util.h @@ -30,7 +30,7 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) /* - * min() macro with strict type-checking. + * min()/max() macros with strict type-checking. * Taken from linux/kernel.h */ #undef min @@ -40,6 +40,13 @@ (void) (&_min1 == &_min2); \ _min1 < _min2 ? _min1 : _min2; }) +#undef max +#define max(x, y) ({ \ + typeof(x) _max1 = (x); \ + typeof(y) _max2 = (y); \ + (void) (&_max1 == &_max2); \ + _max1 > _max2 ? _max1 : _max2; }) + static inline void __noreturn panic(const char *fmt, ...) { va_list vl; -- cgit v1.2.3-54-g00ecf