core: add ARRAY_SIZE macro
This commit is contained in:
parent
900fdcf783
commit
fcf31724a6
@ -108,6 +108,16 @@
|
|||||||
#define UNREACHABLE() do { /* nothing */ } while (1)
|
#define UNREACHABLE() do { /* nothing */ } while (1)
|
||||||
#endif
|
#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)
|
* @def ALIGN_OF(T)
|
||||||
* @brief Calculate the minimal alignment for type T.
|
* @brief Calculate the minimal alignment for type T.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user