Commit a3a42a4c authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

compiler: Add NELEMS_AS_ARRAY helper

To count elems in accumulator.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent 0fb2f0e5
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
*/ */
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #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 BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#define ASSIGN_TYPED(a, b) do { (a) = (typeof(a))(b); } while (0) #define ASSIGN_TYPED(a, b) do { (a) = (typeof(a))(b); } while (0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment