lkml.org 
[lkml]   [2021]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] bitops: Add single_bit_set()
On Mon, Nov 22, 2021 at 02:57:27PM +0200, 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:

...

> > I think I actually tried using hweight() at some point but don't really
> > remember why I rolled the single_bit_set. (I remember the hweight()
> > usage because I had to do some googling as I had never heard term
> > hamming weight before).
>
> Oh, it should be a very good reason not to use hweight() since on some
> architectures it might become just one assembly instruction.

(for the sake of educational purposes to us both)
https://vaibhavsagar.com/blog/2019/09/08/popcount/

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2021-11-22 14:01    [W:0.103 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site