Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp880466pxb; Wed, 27 Oct 2021 14:21:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7RKPXBd7i5Mz5eUCoT9xifbJP682Xb8QaRsd6Gz38VGkKsUtVDHdwIdQ1sGbV6JsEbmnr X-Received: by 2002:a17:906:b884:: with SMTP id hb4mr43069ejb.376.1635369709323; Wed, 27 Oct 2021 14:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635369709; cv=none; d=google.com; s=arc-20160816; b=YDXAJymnV5fFJ1cfq5bEkvsyBSIeLWFamUfL4PRApEC8VbXlfueNbb9yGgiO6i4RKr BAl6UveMKlcuyzFUgcLi9Z3x8Nsqf2dPy3oswnDyBIjTWt/yOxTK3nn0aGZVSzXP6mIQ sqOckzrY+Rn2rexRkE39PeVpoZQ5Fx2hx2uwhjDAZVSTomV8Wcd1AHCf+ez2a9P0G4CB 0+VEnwfE9fEFZruDrzWe6q5yfXzk4aGIQG2WmthAVeAvt0p0h9+ApJkMPdDY5FwUW6pE 6PKtohBp4veoTvMN8tkiQFmh/LZvht+wlTqWhWfSgBu/m1jgTQX6nlGljzDg32IOv3xD aDJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=wACqh/c8IcfHSJiTDevwXg5vVa/nYDhik1921WSl/4A=; b=u6uWDgB3XQIHj5rMWb5DPW069CNH3k+1Np1Dbp61R198snVLlQaIn5MOin8Pb+8/y7 P2P7X33yIxDRWtMe7nOrUUIdwL004wLsp6WDG7/xlbHi8HywdGHBC4yLTYnxuxoM+jHj rBX1SyMnOefq2JK6PRBQOKKQUhe20rXsBjwTwmcqfF+nuth5bNvXd+UoFCugUM4B5T2p jMDZtDBfNR6+5nAytOnsAkvs6Fqf+UcCJivBM1vOZKAWXIEdEgicJFu10S140f7Q69rJ J5c36S3X9fNcdOKhZwJMm+OUmDINcnbpIYXy2rZxU3MdQFazi3hfUABMckXFGvqK/dCI Vpyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cz17si1176743edb.110.2021.10.27.14.21.25; Wed, 27 Oct 2021 14:21:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241126AbhJ0Jhp (ORCPT + 97 others); Wed, 27 Oct 2021 05:37:45 -0400 Received: from mga05.intel.com ([192.55.52.43]:65461 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241205AbhJ0Jhn (ORCPT ); Wed, 27 Oct 2021 05:37:43 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10149"; a="316325577" X-IronPort-AV: E=Sophos;i="5.87,186,1631602800"; d="scan'208";a="316325577" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2021 02:35:17 -0700 X-IronPort-AV: E=Sophos;i="5.87,186,1631602800"; d="scan'208";a="597295484" Received: from smile.fi.intel.com ([10.237.72.184]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2021 02:35:15 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1mffKi-001QZK-3E; Wed, 27 Oct 2021 12:34:56 +0300 Date: Wed, 27 Oct 2021 12:34:55 +0300 From: Andy Shevchenko To: Qian Cai Cc: Yury Norov , Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: Re: [PATCH] bitmap: simplify GENMASK(size - 1, 0) lines Message-ID: References: <20211026144108.35373-1-quic_qiancai@quicinc.com> <397751ea-536b-af3c-752d-c4b1045e6e56@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <397751ea-536b-af3c-752d-c4b1045e6e56@quicinc.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 26, 2021 at 03:33:48PM -0400, Qian Cai wrote: > On 10/26/21 3:21 PM, Andy Shevchenko wrote: > > Can you explain to me how it is supposed to work? > > > > For example, > > > > x = 0xaa55; > > size = 5; > > > > printf("%lu\n", find_first_bit(&x, size)); > > > > In the resulting code we will always have 5 as the result, > > but is it correct one? > > Sorry, my bad. GENMASK(size - 1, 0) would just become __GENMASK(size - > 1, 0) instead of 0. Let me revisit it and run some tests first. And we do not want to have __GENMASK() in the code. Btw, I found one lurking around. Will fix it. -- With Best Regards, Andy Shevchenko