diff --git a/core/include/kernel_defines.h b/core/include/kernel_defines.h index 79c71973a5..48900d7011 100644 --- a/core/include/kernel_defines.h +++ b/core/include/kernel_defines.h @@ -108,6 +108,16 @@ #define UNREACHABLE() do { /* nothing */ } while (1) #endif +/** + * @def ARRAY_SIZE(a) + * @brief Calculate the number of elements in a static array. + * @param[in] a Array to examine + * @returns The number of elements in the array a. + */ +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) +#endif + /** * @def ALIGN_OF(T) * @brief Calculate the minimal alignment for type T.