Re: [RFC PATCH 1/2] bits: introduce ffs_val()
From: Arnd Bergmann
Date: Fri Jan 09 2026 - 12:01:27 EST
On Fri, Jan 9, 2026, at 17:37, Petr Tesarik wrote:
> + * Returns:
> + * least significant non-zero bit, 0 if all bits are zero
> + */
> +#define ffs_val(x) \
> +({ \
> + const typeof(x) val__ = (x); \
> + val__ & -val__; \
> +})
This looks good to me, but I'd suggest using 'const auto val__'
instead of typeof(), to reduce expanding complex arguments twice.
Arnd