Re: [PATCH] bitmap: optimize bitmap_remap()

From: Andy Shevchenko
Date: Thu Aug 17 2023 - 05:39:18 EST


On Thu, Aug 17, 2023 at 12:37:05PM +0300, Andy Shevchenko wrote:
> On Tue, Aug 15, 2023 at 04:59:34PM -0700, Yury Norov wrote:

...

> > int n = bitmap_pos_to_ord(old, oldbit, nbits);
> >
> > + bit = (n < 0) ? oldbit : /* identity map */
>
> Can't you also optimize this case?
>
> Something like
>
> bitmap_xor(tmp, old, new) // maybe even better approach, dunno

> bitmap_empty(tmp) // can be replaced by find first bit

Or reuse bitmap_weight()...

> ?

--
With Best Regards,
Andy Shevchenko