Messages in this thread | | | Date | Tue, 26 Mar 2019 15:18:54 +0200 | From | Andy Shevchenko <> | Subject | Re: [PATCH v12 01/11] bitops: Introduce the for_each_set_clump8 macro |
| |
On Tue, Mar 26, 2019 at 02:03:19PM +0100, Lukas Wunner wrote: > On Tue, Mar 26, 2019 at 07:08:18PM +0900, William Breathitt Gray wrote: > > On Tue, Mar 26, 2019 at 10:43:45AM +0100, Lukas Wunner wrote:
> > In this case, bitmap_get_value8 could be simplified to something like > > this: > > > > index = BIT_WORD(start); > > offset = start % BITS_PER_LONG; > > return (bitmap[index] >> offset) & 0xFF; >
> Hm, shouldn't that be "offset = round_down(start, 8)" ?
No, the index points to the word, the offset points to the offset inside word.
> (I prefer the multi-line version FWIW.)
+1 here.
> > Would it be better to define bitmap_get_value8 as a macro then? > > Or a static inline.
Please, no macro. It disadvantages in terms of type checking.
-- With Best Regards, Andy Shevchenko
| |