From c15c42ca35237e4e456b015e04894828d454d51b Mon Sep 17 00:00:00 2001 From: antifallobst Date: Sat, 11 Feb 2023 14:45:22 +0100 Subject: [PATCH] fix (kernel): Fixed 'CEIL_TO' bug, that caused the value to ceil up one step, if already aligned --- kernel/inc/utils/math.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/inc/utils/math.h b/kernel/inc/utils/math.h index ababdf2..42523da 100644 --- a/kernel/inc/utils/math.h +++ b/kernel/inc/utils/math.h @@ -20,7 +20,7 @@ #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)) +#define CEIL_TO(a, b) (a % b ? a + b - (a % b) : a) #define FLOOR_TO(a, b) (a - (a % b)) uint64_t pow(uint64_t base, uint64_t exp);