Messages in this thread | | | Date | Mon, 22 Nov 2021 15:00:00 +0200 | From | Andy Shevchenko <> | Subject | Re: [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
| |