From e45107dac7f9f2bdc3aa0aaff3960492dd8a0ed6 Mon Sep 17 00:00:00 2001 From: Yakun Xu Date: Thu, 17 Jan 2019 18:59:32 +0800 Subject: [PATCH] [code-utils] fix wrong pointer size in otALIGN (#3468) --- src/core/common/code_utils.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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))