1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

Merge pull request #17148 from benpicco/index_of

core/include/kernel_defines.h: Fix index_of()
This commit is contained in:
benpicco 2021-11-06 11:32:43 +01:00 committed by GitHub
commit 2b43675ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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