Added a couple of new macros

Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
2024-12-06 17:30:56 +02:00
parent e45152d20f
commit 2ccfad3875

View File

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