diff --git a/core/include/kernel_defines.h b/core/include/kernel_defines.h index f52830e669..2d80b8dd90 100644 --- a/core/include/kernel_defines.h +++ b/core/include/kernel_defines.h @@ -71,7 +71,7 @@ extern "C" { * @param[in] ELEMENT pointer to an array element * @return Index of the element in the array */ -#define index_of(ARRAY, ELEMENT) (((uintptr_t)(ELEMENT) - (uintptr_t)(ARRAY)) / sizeof(*(ELEMENT))) +#define index_of(ARRAY, ELEMENT) (((uintptr_t)(ELEMENT) - (uintptr_t)(ARRAY)) / sizeof((ARRAY)[0])) /** * @def NORETURN