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: <c7b488fd-a0a7-2ec7-c711-7a6507fb2731@fi.rohmeurope.com>
Date:   Tue, 23 Nov 2021 11:42:32 +0000
From:   "Vaittinen, Matti" <Matti.Vaittinen@...rohmeurope.com>
To:     David Laight <David.Laight@...LAB.COM>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC:     Matti Vaittinen <mazziesaccount@...il.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Jiri Kosina <trivial@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Yury Norov <yury.norov@...il.com>,
        Kumar Kartikeya Dwivedi <memxor@...il.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/4] bitops: Add single_bit_set()

On 11/23/21 12:42, David Laight wrote:
> From: Vaittinen, Matti
>> Sent: 22 November 2021 13:19
>>
>> On 11/22/21 14:57, Andy Shevchenko wrote:
>>> On Mon, Nov 22, 2021 at 12:42:21PM +0000, Vaittinen, Matti wrote:
>>>> On 11/22/21 13:28, Andy Shevchenko wrote:
>>>>> On Mon, Nov 22, 2021 at 01:03:25PM +0200, Matti Vaittinen wrote:
>>>
>>> What do you mean by this?
>>>
>>> hweight() will return you the number of the non-zero elements in the set.
>>
>> Exactly. The function I added did only check if given set of bits had
>> only one bit set.
> 
> Checking for exactly one bit can use the (x & (x - 1)) check on
> non-zero values

Thanks! This was educating. I admit I had to launch a calculator with 
bit editor to see where this went to. I doubt I had ever noticed such 
possibility if I didn't send the original patch. I guess this is the 
true power of the collaboration ;)

Best Regards
--Matti

-- 
The Linux Kernel guy at ROHM Semiconductors

Matti Vaittinen, Linux device drivers
ROHM Semiconductors, Finland SWDC
Kiviharjunlenkki 1E
90220 OULU
FINLAND

~~ this year is the year of a signature writers block ~~

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ