[CRIU] [PATCH 01/15] compiler: Add NELEMS_AS_ARRAY helper

Cyrill Gorcunov gorcunov at gmail.com
Thu Sep 13 22:57:44 MSK 2018


To count elems in accumulator.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 include/common/compiler.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/common/compiler.h b/include/common/compiler.h
index eaf545b26c29..fc8abcfef48b 100644
--- a/include/common/compiler.h
+++ b/include/common/compiler.h
@@ -8,6 +8,7 @@
  */
 
 #define ARRAY_SIZE(x)		(sizeof(x) / sizeof((x)[0]))
+#define NELEMS_AS_ARRAY(x,y)	(sizeof(x) / sizeof((y)[0]))
 #define BUILD_BUG_ON(condition)	((void)sizeof(char[1 - 2*!!(condition)]))
 
 #define ASSIGN_TYPED(a, b)	do { (a) = (typeof(a))(b); } while (0)
-- 
2.17.1



More information about the CRIU mailing list