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