lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLa-1GPJDxpX-soG@smile.fi.intel.com>
Date: Tue, 2 Sep 2025 12:54:28 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
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: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.
That said, using

	GENMASK_ULL(end - 1, 0)

in both cases makes also them look more similar (and opposition comes on how
start is being used).

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ