2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

compiler: Add NELEMS_AS_ARRAY helper

To count elems in accumulator.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
Cyrill Gorcunov
2018-09-13 22:57:44 +03:00
committed by Andrei Vagin
parent 0fb2f0e56a
commit a3a42a4ce7

View File

@@ -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)