From fc148378f7748b997b8f8c3995b04ab809916e8d Mon Sep 17 00:00:00 2001 From: antifallobst Date: Sat, 4 Mar 2023 23:45:41 +0100 Subject: [PATCH] fix (utils): fixed ceil_to bug, when inserting calculations instead of numbers --- kernel/inc/utils/math.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/inc/utils/math.h b/kernel/inc/utils/math.h index 26d3cea..2ef7a10 100644 --- a/kernel/inc/utils/math.h +++ b/kernel/inc/utils/math.h @@ -27,10 +27,10 @@ #include "stdtypes.h" #include "string.h" -#define MAX(a, b) (a > b ? a : b) -#define MIN(a, b) (a > b ? b : a) -#define CEIL_TO(a, b) (a % b ? a + b - (a % b) : a) -#define FLOOR_TO(a, b) (a - (a % b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) > (b) ? (b) : (a)) +#define CEIL_TO(a, b) ((a) % (b) ? (a) + (b) - ((a) % (b)) : (a)) +#define FLOOR_TO(a, b) ((a) - ((a) % (b))) typedef struct { uint64_t x;