[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190326095312.GR9224@smile.fi.intel.com>
Date: Tue, 26 Mar 2019 11:53:12 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Lukas Wunner <lukas@...ner.de>
Cc: William Breathitt Gray <vilhelm.gray@...il.com>,
linus.walleij@...aro.org, bgolaszewski@...libre.com,
akpm@...ux-foundation.org, linux-gpio@...r.kernel.org,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
linux@...musvillemoes.dk, yamada.masahiro@...ionext.com,
linux-arm-kernel@...ts.infradead.org, linux-pm@...r.kernel.org,
geert@...ux-m68k.org, preid@...ctromag.com.au,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH v12 01/11] bitops: Introduce the for_each_set_clump8 macro
On Tue, Mar 26, 2019 at 10:43:45AM +0100, Lukas Wunner wrote:
> On Tue, Mar 26, 2019 at 12:14:22PM +0900, William Breathitt Gray wrote:
> > On Mon, Mar 25, 2019 at 10:38:54AM +0100, Lukas Wunner wrote:
> > Is this the sort of implementation you had in mind:
> >
> > offset = find_next_bit(addr, size, offset);
> > if (offset == size)
> > return size;
> >
> > offset -= offset % 8;
> > *clump = bitmap_get_value8(addr, size, offset);
> >
> > return offset;
>
> Almost. I'd use round_down() instead of "offset -= offset % 8".
> Then it's just a single cheap logical and operation at runtime.
> I'd try to avoid copying around the clump value and use a pointer
> to u8 instead.
u8 might be inconvenient in environment where everything else is type of
unsigned long.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists