mirror of
https://github.com/szehl/ath9k-hmac.git
synced 2025-01-05 05:24:36 +00:00
17 lines
509 B
C
17 lines
509 B
C
/*
|
|
* These tricks are taken from
|
|
* http://efesx.com/2010/07/17/variadic-macro-to-count-number-of-arguments/
|
|
* and
|
|
* http://efesx.com/2010/08/31/overloading-macros/
|
|
*/
|
|
|
|
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL(__VA_ARGS__, 5,4,3,2,1)
|
|
#define VA_NUM_ARGS_IMPL(_1,_2,_3,_4,_5,N,...) N
|
|
|
|
#define macro_dispatcher(func, ...) \
|
|
macro_dispatcher_(func, VA_NUM_ARGS(__VA_ARGS__))
|
|
#define macro_dispatcher_(func, nargs) \
|
|
macro_dispatcher__(func, nargs)
|
|
#define macro_dispatcher__(func, nargs) \
|
|
func ## nargs
|