mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
include: Add nitems() definition to sys/param.h
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
@@ -43,6 +43,14 @@
|
|||||||
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
# define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||||
#endif /* MAX */
|
#endif /* MAX */
|
||||||
|
|
||||||
|
/* Macros for number of items.
|
||||||
|
* (aka. ARRAY_SIZE, ArraySize, Size of an Array)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef nitems
|
||||||
|
# define nitems(_a) (sizeof(_a) / sizeof(0[(_a)]))
|
||||||
|
#endif /* nitems */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Type Definitions
|
* Public Type Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user