[lkml]   [2020]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v7 1/4] bitops: Introduce the the for_each_set_clump macro
On Sat, May 30, 2020 at 2:50 PM Andy Shevchenko
<> wrote:
> On Sat, May 30, 2020 at 11:45 AM Syed Nayyar Waris <> wrote:
> > On Sat, May 30, 2020 at 3:49 AM Andy Shevchenko
> > <> wrote:
> ...
> > I am still investigating more on this. Let me know if you have any suggestions.
> As far as I understand the start pointers are implementations of abs()
> macro followed by min()/max().
> I think in the latter case it's actually something which might help here.
> Sorry, right now I have no time to dive deeper.

No Problem. Thank you for sharing your initial pointers.

By the way, as I was working on it I found a way to avoid comparison
with '0' in '__builtin_constant_p'. And because of this, no
compilation warnings are getting produced.

Change the following:

#define GENMASK_INPUT_CHECK(h, l) \
(BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
__builtin_constant_p((l) > (h)), (l) > (h), 0)))

To this:

#if (l) == 0
#define GENMASK_INPUT_CHECK(h, l) 0
#define GENMASK_INPUT_CHECK(h, l) \
(BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
__builtin_constant_p((l) > (h)), (l) > (h), 0)))

I have verified that this works. Basically this just avoids the sanity
check when the 'lower' bound 'l' is zero. Let me know if it looks

Regarding min, max macro that you suggested I am also looking further into it.

Syed Nayyar Waris

 \ /
  Last update: 2020-05-31 03:13    [W:0.100 / U:0.912 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site