From 912ca62a7b66de420ab6480993fc7968a1a7953f Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 5 Jan 2022 19:45:09 +1100 Subject: [PATCH] [common] only define min/max if they have not already been defined --- common/include/common/util.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/include/common/util.h b/common/include/common/util.h index b4c39d75..0f5a2fe4 100644 --- a/common/include/common/util.h +++ b/common/include/common/util.h @@ -21,10 +21,15 @@ #ifndef _H_LG_COMMON_UTIL_ #define _H_LG_COMMON_UTIL_ +#ifndef min #define min(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); \ _a < _b ? _a : _b; }) +#endif + +#ifndef max #define max(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); \ _a > _b ? _a : _b; }) +#endif #define UPCAST(type, x) \ (type *)((uintptr_t)(x) - offsetof(type, base))