Thu, 30 Dec 2010 00:44:25 +0000
add NELEMS macro to utils.h
src/utils.h | file | annotate | diff | revisions |
1.1 diff -r 822d8b2c4639 -r 4e5d95fa96e1 src/utils.h 1.2 --- a/src/utils.h Thu Dec 30 00:41:48 2010 +0000 1.3 +++ b/src/utils.h Thu Dec 30 00:44:25 2010 +0000 1.4 @@ -1,5 +1,5 @@ 1.5 -#ifndef _H_UTILS 1.6 -#define _H_UTILS 1.7 +#ifndef _UTILS_H 1.8 +#define _UTILS_H 1.9 1.10 #ifndef NDEBUG 1.11 /// Log a message to stderr 1.12 @@ -11,4 +11,7 @@ 1.13 #define LOG_IF(cond, x, ...) 1.14 #endif 1.15 1.16 +/// Get the number of elements in an array 1.17 +#define NELEMS(x) (sizeof(x)/sizeof(x[0])) 1.18 + 1.19 #endif // _H_UTILS