[PATCH v3 1/3] drm/xe: Add helpers for manipulating macro arguments
Andy Shevchenko
andriy.shevchenko at linux.intel.com
Fri May 3 15:59:07 UTC 2024
On Fri, May 03, 2024 at 12:33:11AM +0200, Michal Wajdeczko wrote:
> Define generic helpers that will replace private definitions used
> by the RTP code and will allow reuse by the new code.
>
> Put them in new xe_args.h file (instead of infamous xe_macros.h)
> as once we find more potential users outside of the Xe driver we
> may want to move all of these macros as-is to linux/args.h.
...
> +#define DROP_FIRST(args...) __DROP_FIRST(args)
> +#define __DROP_FIRST(a, b...) b
> +#define PICK_FIRST(args...) __PICK_FIRST(args)
> +#define __PICK_FIRST(a, b...) a
> +#define PICK_LAST(args...) __PICK_ARG(COUNT_ARGS(args), args)
All but these have ARG(S) in the name, I would add it.
> +#define __PICK_ARG(n, args...) CALL_ARGS(CONCATENATE(PICK_ARG, n), args)
Interesting, why FIRST and LAST are not symmetrical. Maybe the first
counterpart can use the __PICK_ARG()?
--
With Best Regards,
Andy Shevchenko
More information about the Intel-xe
mailing list