[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLbDFcaqzJtZUdCB@stanley.mountain>
Date: Tue, 2 Sep 2025 13:12:37 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Adrian Barnaś <abarnas@...gle.com>,
Hans de Goede <hansg@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Andy Shevchenko <andy@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev
Subject: Re: [RFC] staging: media: atomisp: Simplyfy masking bit logic
On Tue, Sep 02, 2025 at 12:54:28PM +0300, Andy Shevchenko wrote:
> On Tue, Sep 02, 2025 at 12:02:29PM +0300, Dan Carpenter wrote:
> > On Tue, Sep 02, 2025 at 07:38:40AM +0000, Adrian Barnaś wrote:
>
> ...
>
> > > static inline hive_uedge
> > > inv_subword(hive_uedge w, unsigned int start, unsigned int end)
> > > {
> > > - return w & (~(((1ULL << (end - 1)) - 1) << 1 | 1) | ((1ULL << start) - 1));
> > > + return w & (~__GENMASK_ULL(end-1, start));
> > > }
> >
> > nit: white space. Add spaces. Remove parentheses.
> >
> > These are supposed to be opposites, right? Subword and inverse Subword.
> > You could dress them up to make them look more opposite.
> >
> > return (w & __GENMASK_ULL(end - 1, start)) >> start;
> > return w & ~__GENMASK_ULL(end - 1, start);
>
> The problem is (and actually with the (end-1, start) above that it might
> generate a really bad code on some CPUs, so I really, really prefer the way
> when _at least_ one of the parameters is constant.
Ah. Okay. That makes sense. Thanks.
regards,
dan carpenter
Powered by blists - more mailing lists