diff --git a/src/core/common/code_utils.hpp b/src/core/common/code_utils.hpp index 3e0c64e58..020c726fc 100644 --- a/src/core/common/code_utils.hpp +++ b/src/core/common/code_utils.hpp @@ -57,7 +57,8 @@ * @returns The aligned pointer. * */ -#define otALIGN(aPointer, aAlignment) ((void *)(((uintptr_t)(aPointer) + (aAlignment)-1U) & ~((aAlignment)-1U))) +#define otALIGN(aPointer, aAlignment) \ + ((void *)(((uintptr_t)(aPointer) + (aAlignment)-1UL) & ~((uintptr_t)(aAlignment)-1UL))) // Calculates the aligned variable size. #define otALIGNED_VAR_SIZE(size, align_type) (((size) + (sizeof(align_type) - 1)) / sizeof(align_type))