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] [day] [month] [year] [list]
Message-ID: <b2b632cc-ca69-497f-9cf9-782bd02cac79@intel.com>
Date: Thu, 13 Mar 2025 14:09:24 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: "H. Peter Anvin" <hpa@...or.com>, Yury Norov <yury.norov@...il.com>
CC: David Laight <david.laight.linux@...il.com>, Jiri Slaby
	<jirislaby@...nel.org>, Ingo Molnar <mingo@...nel.org>, Kuan-Wei Chiu
	<visitorckw@...il.com>, <tglx@...utronix.de>, <mingo@...hat.com>,
	<bp@...en8.de>, <dave.hansen@...ux.intel.com>, <x86@...nel.org>,
	<jk@...abs.org>, <joel@....id.au>, <eajames@...ux.ibm.com>,
	<andrzej.hajda@...el.com>, <neil.armstrong@...aro.org>, <rfoss@...nel.org>,
	<maarten.lankhorst@...ux.intel.com>, <mripard@...nel.org>,
	<tzimmermann@...e.de>, <airlied@...il.com>, <simona@...ll.ch>,
	<dmitry.torokhov@...il.com>, <mchehab@...nel.org>, <awalls@...metrocast.net>,
	<hverkuil@...all.nl>, <miquel.raynal@...tlin.com>, <richard@....at>,
	<vigneshr@...com>, <louis.peens@...igine.com>, <andrew+netdev@...n.ch>,
	<davem@...emloft.net>, <edumazet@...gle.com>, <pabeni@...hat.com>,
	<parthiban.veerasooran@...rochip.com>, <arend.vanspriel@...adcom.com>,
	<johannes@...solutions.net>, <gregkh@...uxfoundation.org>,
	<akpm@...ux-foundation.org>, <alistair@...ple.id.au>,
	<linux@...musvillemoes.dk>, <Laurent.pinchart@...asonboard.com>,
	<jonas@...boo.se>, <jernej.skrabec@...il.com>, <kuba@...nel.org>,
	<linux-kernel@...r.kernel.org>, <linux-fsi@...ts.ozlabs.org>,
	<dri-devel@...ts.freedesktop.org>, <linux-input@...r.kernel.org>,
	<linux-media@...r.kernel.org>, <linux-mtd@...ts.infradead.org>,
	<oss-drivers@...igine.com>, <netdev@...r.kernel.org>,
	<linux-wireless@...r.kernel.org>, <brcm80211@...ts.linux.dev>,
	<brcm80211-dev-list.pdl@...adcom.com>, <linux-serial@...r.kernel.org>,
	<bpf@...r.kernel.org>, <jserv@...s.ncku.edu.tw>, Yu-Chun Lin
	<eleanor15x@...il.com>
Subject: Re: [PATCH v3 01/16] bitops: Change parity8() return type to bool



On 3/13/2025 9:36 AM, H. Peter Anvin wrote:
> On March 13, 2025 9:24:38 AM PDT, Yury Norov <yury.norov@...il.com> wrote:
>> On Wed, Mar 12, 2025 at 05:09:16PM -0700, H. Peter Anvin wrote:
>>> On March 12, 2025 4:56:31 PM PDT, Jacob Keller <jacob.e.keller@...el.com> wrote:
>>
>> [...]
>>
>>>> This is really a question of whether you expect odd or even parity as
>>>> the "true" value. I think that would depend on context, and we may not
>>>> reach a good consensus.
>>>>
>>>> I do agree that my brain would jump to "true is even, false is odd".
>>>> However, I also agree returning the value as 0 for even and 1 for odd
>>>> kind of made sense before, and updating this to be a bool and then
>>>> requiring to switch all the callers is a bit obnoxious...
>>>
>>> Odd = 1 = true is the only same definition. It is a bitwise XOR, or sum mod 1.
>>
>> The x86 implementation will be "popcnt(val) & 1", right? So if we
>> choose to go with odd == false, we'll have to add an extra negation.
>> So because it's a purely conventional thing, let's just pick a simpler
>> one?
>>
>> Compiler's builtin parity() returns 1 for odd.
>>
>> Thanks,
>> Yury
> 
> The x86 implementation, no, but there will be plenty of others having that exact definition.

Makes sense to stick with that existing convention then. Enough to
convince me.

Thanks,
Jake

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ