diff --git a/include/sys/param.h b/include/sys/param.h index 4e94f51bbc..831a552eae 100644 --- a/include/sys/param.h +++ b/include/sys/param.h @@ -43,6 +43,14 @@ # define MAX(a,b) (((a) > (b)) ? (a) : (b)) #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 ****************************************************************************/