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:
commit
2b43675ded
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user