From a3a42a4ce706bebf268a6dffe622b8c6747b160b Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Thu, 13 Sep 2018 22:57:44 +0300 Subject: [PATCH] compiler: Add NELEMS_AS_ARRAY helper To count elems in accumulator. Signed-off-by: Cyrill Gorcunov Signed-off-by: Andrei Vagin --- include/common/compiler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/common/compiler.h b/include/common/compiler.h index eaf545b26..fc8abcfef 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)