diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2023-04-18 14:39:51 +0300 |
---|---|---|
committer | David Ahern <dsahern@kernel.org> | 2023-04-24 19:42:21 -0600 |
commit | 1865a60871fb44b842fb758172648b24dfc37394 (patch) | |
tree | c50bf27996d9d9e8a522132bfebfefe1314f1a06 | |
parent | f57ac749b0359c9239b09a6c80573d5a94245b5b (diff) | |
download | iproute2-1865a60871fb44b842fb758172648b24dfc37394.tar.gz |
utils: add max() definition
There is already a min() definition, add this below it.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
-rw-r--r-- | include/utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/utils.h b/include/utils.h index 2eb80b3e..0f1b3bef 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)))) |