diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-02-18 17:54:50 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-02-18 17:54:50 +0100 |
commit | a8f51c2e2c94387e7dcd95dcb12371b7253847f8 (patch) | |
tree | 0ddc3891823e2be8c293420ad72b144cf6223ba6 /util.h | |
parent | e6e971ba1b23bb67b43a909b486cbad5c6e96e06 (diff) |
llmnrd: Add IPv6 support
Closes #5
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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; |