From 6d5759a2600b2cb96f122441e5fd0dddaf739f43 Mon Sep 17 00:00:00 2001 From: Yonghua Huang Date: Thu, 22 Apr 2021 14:47:54 +0800 Subject: [PATCH] hv: bugfix in min() and max() MACROs These two MACROs shall be wrapped as a single value respectively, hence brackets should be used. Tracked-On: #5951 Signed-off-by: Yonghua Huang --- hypervisor/include/lib/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/include/lib/util.h b/hypervisor/include/lib/util.h index 8ed6c5b08..d6918d27b 100644 --- a/hypervisor/include/lib/util.h +++ b/hypervisor/include/lib/util.h @@ -18,9 +18,9 @@ /** Roundup (x) to (y) aligned **/ #define roundup(x, y) (((x) + ((y) - 1UL)) & (~((y) - 1UL))) -#define min(x, y) ((x) < (y)) ? (x) : (y) +#define min(x, y) (((x) < (y)) ? (x) : (y)) -#define max(x, y) ((x) < (y)) ? (y) : (x) +#define max(x, y) (((x) < (y)) ? (y) : (x)) /** Replaces 'x' by the string "x". */ #define STRINGIFY(x) #x