Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17771C4332F for ; Mon, 22 Nov 2021 13:00:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234460AbhKVNDQ (ORCPT ); Mon, 22 Nov 2021 08:03:16 -0500 Received: from mga07.intel.com ([134.134.136.100]:43751 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbhKVNDP (ORCPT ); Mon, 22 Nov 2021 08:03:15 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10175"; a="298190983" X-IronPort-AV: E=Sophos;i="5.87,254,1631602800"; d="scan'208";a="298190983" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2021 05:00:08 -0800 X-IronPort-AV: E=Sophos;i="5.87,254,1631602800"; d="scan'208";a="508553970" Received: from smile.fi.intel.com ([10.237.72.184]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2021 05:00:05 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mp8vR-009RBu-A1; Mon, 22 Nov 2021 15:00:01 +0200 Date: Mon, 22 Nov 2021 15:00:00 +0200 From: Andy Shevchenko To: "Vaittinen, Matti" Cc: Matti Vaittinen , Liam Girdwood , Mark Brown , Jiri Kosina , Andrew Morton , Yury Norov , Kumar Kartikeya Dwivedi , Rasmus Villemoes , Geert Uytterhoeven , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/4] bitops: Add single_bit_set() Message-ID: References: <73d5e4286282a47b614d1cc5631eb9ff2a7e2b44.1637330431.git.matti.vaittinen@fi.rohmeurope.com> <2c22b52f-9a1f-06f5-f008-d568096f5c4d@fi.rohmeurope.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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