Re: [PATCH v9 1/9] bitops: Introduce the for_each_set_clump8 macro
From: Andy Shevchenko
Date: Tue Mar 12 2019 - 03:14:28 EST
On Tue, Mar 12, 2019 at 7:04 AM Masahiro Yamada
<yamada.masahiro@xxxxxxxxxxxxx> wrote:
> On Sun, Mar 3, 2019 at 4:48 PM William Breathitt Gray
> <vilhelm.gray@xxxxxxxxx> wrote:
> >
> > This macro iterates for each 8-bit group of bits (clump) with set bits,
> > within a bitmap memory region. For each iteration, "start" is set to the
> > bit offset of the found clump, while the respective clump value is
> > stored to the location pointed by "clump". Additionally, the
> > bitmap_get_value8 and bitmap_set_value8 functions are introduced to
> > respectively get and set an 8-bit value in a bitmap memory region.
> > +/**
> > + * bitmap_get_value8 - get an 8-bit value within a memory region
> > + * @bitmap: address to the bitmap memory region
> > + * @size: bitmap size in number of bits
> > + * @start: bit offset of the 8-bit value
> > + *
> > + * Returns the 8-bit value located at the @start bit offset within the @bitmap
> > + * memory region.
> > + */
> > +unsigned long bitmap_get_value8(const unsigned long *const bitmap,
> > + const unsigned int size,
> > + const unsigned int start)
>
>
> The comment says this function returns '8-bit value'.
>
> The return type should be 'u8' instead of 'unsigned long', then.
>
> Same for other helpers.
This is done in a way to be consistent with the rest of bitmap API.
None of them returns boolean, for example, for single bit.
--
With Best Regards,
Andy Shevchenko