From 2ccfad3875da3e200519c1ca45d2386f0ac9f822 Mon Sep 17 00:00:00 2001 From: Robear Selwans Date: Fri, 6 Dec 2024 17:30:56 +0200 Subject: [PATCH] Added a couple of new macros Signed-off-by: Robear Selwans --- ev_macros.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ev_macros.h b/ev_macros.h index 27dcd66..a154766 100644 --- a/ev_macros.h +++ b/ev_macros.h @@ -104,6 +104,7 @@ * \brief Macro to get the size of a compile-time array. */ #define EV_ARRSIZE(...) (sizeof(__VA_ARGS__)/sizeof((__VA_ARGS__)[0])) +#define EV_ARRSIZE_LITERAL(...) EV_EXPAND(EV_DEFER(EV_VA_ARGS_NARG)(EV_FILTER_EMPTY(__VA_ARGS__))) /*! * \brief Macro to concatenate two tokens together. @@ -226,4 +227,7 @@ */ #define EV_TOHEX_CHAR(c) (("0123456789abcdef")[c]) +#define __EV_FILTER_EMPTY_OP(x) EV_VA_OPT_ELSE(x)(,x)() +#define EV_FILTER_EMPTY(x,...) x EV_FOREACH(__EV_FILTER_EMPTY_OP, __VA_ARGS__) + #endif // EV_HEADERS_MACROS_H