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]
Date: Fri, 10 May 2024 18:28:51 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Jani Nikula <jani.nikula@...el.com>
Cc: Devarsh Thakkar <devarsht@...com>, mchehab@...nel.org,
	hverkuil-cisco@...all.nl, linux-media@...r.kernel.org,
	linux-kernel@...r.kernel.org, benjamin.gaignard@...labora.com,
	sebastian.fricke@...labora.com, akpm@...ux-foundation.org,
	gregkh@...uxfoundation.org, adobriyan@...il.com,
	p.zabel@...gutronix.de, airlied@...il.com, daniel@...ll.ch,
	dri-devel@...ts.freedesktop.org, laurent.pinchart@...asonboard.com,
	praneeth@...com, nm@...com, vigneshr@...com, a-bhatia1@...com,
	j-luthra@...com, b-brnich@...com, detheridge@...com,
	p-mantena@...com, vijayp@...com, andrzej.p@...labora.com,
	nicolas@...fresne.ca
Subject: Re: [PATCH v7 6/8] math.h Add macros to round to closest specified
 power of 2

On Fri, May 10, 2024 at 06:15:34PM +0300, Jani Nikula wrote:
> On Fri, 10 May 2024, Andy Shevchenko <andriy.shevchenko@...ux.intel.com> wrote:
> > On Fri, May 10, 2024 at 12:09:52AM +0530, Devarsh Thakkar wrote:
> >> Add macros to round to nearest specified power of 2.
> >
> > This is not what they are doing. For the above we already have macros defined.
> >
> >> Two macros are added :
> >
> > (Yes, after I wrapped to comment this line looks better on its own,
> >  so whatever will be the first sentence, this line should be separated
> >  from.)
> >
> >> round_closest_up and round_closest_down which round up to nearest multiple
> >
> > round_closest_up() and round_closest_down()
> >
> >
> >> of 2 with a preference to round up or round down respectively if there are
> >> two possible nearest values to the given number.
> >
> > You should reformulate, because AFAICS there is the crucial difference
> > from these and existing round_*_pow_of_two().
> 
> Moreover, I think the naming of round_up() and round_down() should have
> reflected the fact that they operate on powers of 2. It's unfortunate
> that the difference to roundup() and rounddown() is just the underscore!
> That's just a trap.

FYI:
https://stackoverflow.com/questions/58139219/difference-of-align-and-round-up-macro-in-the-linux-kernel

> So let's perhaps not repeat the same with round_closest_up() and
> round_closest_down()?


-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ