Re: [PATCH] lib: count_zeros: unify count_{leading,trailing}_zeros()
From: Yury Norov
Date: Mon Mar 23 2026 - 14:26:17 EST
On Mon, Mar 23, 2026 at 07:10:05PM +0200, Andy Shevchenko wrote:
> On Mon, Mar 23, 2026 at 01:00:32PM -0400, Yury Norov wrote:
> > The 'leading' helper returns BITS_PER_LONG if x == 0, while 'trailing'
> > one returns COUNT_TRAILING_ZEROS_0, which turns to be -1.
> >
> > None of the current users explicitly check the returned value for
> > COUNT_TRAILING_ZEROS_0, except the loongarch, which tests implicitly
> > for the '>= 0'.
> >
> > So, align count_trailing_zeros() with the count_leading_zeros(), and
> > simplify the loongarch handling.
>
> Makes sense,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Thanks, Andy. Moving in -next for testing then.