Add nitems(), a macro for determining the number of elements in a
statically-allocated array. Obtained from: OpenBSD (in principle) MFC after: 3 days
This commit is contained in:
parent
e32a51888c
commit
f77bb430b9
@ -273,6 +273,7 @@
|
||||
#ifndef howmany
|
||||
#define howmany(x, y) (((x)+((y)-1))/(y))
|
||||
#endif
|
||||
#define nitems(x) (sizeof((x)) / sizeof((x)[0]))
|
||||
#define rounddown(x, y) (((x)/(y))*(y))
|
||||
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
|
||||
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
|
||||
|
Loading…
Reference in New Issue
Block a user