svn commit: r236633 - stable/7/sys/sys
Marius Strobl
marius at FreeBSD.org
Tue Jun 5 19:59:09 UTC 2012
Author: marius
Date: Tue Jun 5 19:59:09 2012
New Revision: 236633
URL: http://svn.freebsd.org/changeset/base/236633
Log:
MFC: r236486
Add nitems(), a macro for determining the number of elements in a
statically-allocated array.
Obtained from: OpenBSD (in principle)
Modified:
stable/7/sys/sys/param.h
Directory Properties:
stable/7/sys/ (props changed)
stable/7/sys/cddl/contrib/opensolaris/ (props changed)
stable/7/sys/contrib/dev/acpica/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
Modified: stable/7/sys/sys/param.h
==============================================================================
--- stable/7/sys/sys/param.h Tue Jun 5 19:59:02 2012 (r236632)
+++ stable/7/sys/sys/param.h Tue Jun 5 19:59:09 2012 (r236633)
@@ -249,6 +249,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 */
More information about the svn-src-stable
mailing list