lkml.org 
[lkml]   [2019]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2019-03-26 10:54    [W:0.096 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site