Add ARRAY_SIZE() helper macro
There are many scenarios where it is convenient to have a helper to evaluate the number of elements in an array. Having this helper in a common place helps avoid duplicated code. Change-Id: I05e9513bca756675483276cb6ae777c487f5a949 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
991d16c7ae
commit
85921c9d25
1 changed files with 2 additions and 0 deletions
|
@ -42,6 +42,8 @@ Misc utilities usable by nanokernel, microkernel, and application code.
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
|
||||
|
||||
#ifndef _ASMLANGUAGE
|
||||
|
||||
/* round "x" up/down to next multiple of "align" (which must be a power of 2) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue