From: Vladimir Oltean Date: Tue, 18 Apr 2023 11:39:51 +0000 (+0300) Subject: utils: add max() definition X-Git-Tag: v6.4.0~41^2~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1865a60871fb44b842fb758172648b24dfc37394;p=thirdparty%2Fiproute2.git utils: add max() definition There is already a min() definition, add this below it. Signed-off-by: Vladimir Oltean Signed-off-by: David Ahern --- diff --git a/include/utils.h b/include/utils.h index 2eb80b3e4..0f1b3bef3 100644 --- a/include/utils.h +++ b/include/utils.h @@ -284,6 +284,14 @@ unsigned int print_name_and_link(const char *fmt, _min1 < _min2 ? _min1 : _min2; }) #endif +#ifndef max +# define max(x, y) ({ \ + typeof(x) _max1 = (x); \ + typeof(y) _max2 = (y); \ + (void) (&_max1 == &_max2); \ + _max1 < _max2 ? _max2 : _max1; }) +#endif + #ifndef __check_format_string # define __check_format_string(pos_str, pos_args) \ __attribute__ ((format (printf, (pos_str), (pos_args))))