From 78e7a9740bee7b159c8ead00f84f7ccfb584679d Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Fri, 2 Dec 2022 15:16:25 +0530 Subject: [PATCH] util: fix ROUND_DOWN_TO alignment type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alignments can only be unsigned. Cast alignment to uint64_t to keep MSVC happy. Signed-off-by: Rohan Garg Reviewed-by: Erik Faye-Lund Reviewed-by: Marek Olšák Part-of: --- src/util/u_math.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/u_math.h b/src/util/u_math.h index 64b4c608744..4c5dac1e251 100644 --- a/src/util/u_math.h +++ b/src/util/u_math.h @@ -681,10 +681,10 @@ ALIGN_NPOT(uintptr_t value, int32_t alignment) * \sa ALIGN() */ static inline uint64_t -ROUND_DOWN_TO(uint64_t value, int32_t alignment) +ROUND_DOWN_TO(uint64_t value, uint32_t alignment) { assert(util_is_power_of_two_nonzero(alignment)); - return ((value) & ~(alignment - 1)); + return ((value) & ~(uint64_t)(alignment - 1)); } /**