[01/15] compiler: Add NELEMS_AS_ARRAY helper

Submitted by Cyrill Gorcunov on Sept. 13, 2018, 7:57 p.m.

Details

Message ID 20180913195758.30566-2-gorcunov@gmail.com
State Accepted
Series "net: Add support for raw inet sockets"
Headers show

Commit Message

Cyrill Gorcunov Sept. 13, 2018, 7:57 p.m.
To count elems in accumulator.

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

Patch hide | download patch | download mbox

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)