From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10B59C433EF for ; Tue, 26 Oct 2021 19:33:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC1BF610F8 for ; Tue, 26 Oct 2021 19:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238818AbhJZTgW (ORCPT ); Tue, 26 Oct 2021 15:36:22 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:60164 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238814AbhJZTgP (ORCPT ); Tue, 26 Oct 2021 15:36:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1635276831; x=1666812831; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=luxtlj1Y6uRTaP9b8yBJzpsSMZuh+ycQHMse587VUzI=; b=x0p5veDmyCiyJ7wNkf12HSR8Mrw8QvifljngrS728VjPnXgKiV8hLM5F 3QiRDewqC2qi5IXujj1PaGMF4f+ajmUmcSIGKgafqu09nSgY0ra6TmEP5 8f1limBl3hfG8wMTvRBpy57kpTYkFE/MMP3Y2P74UubBEg6cx2flcRYDN w=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 26 Oct 2021 12:33:50 -0700 X-QCInternal: smtphost Received: from nalasex01a.na.qualcomm.com ([10.47.209.196]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2021 12:33:50 -0700 Received: from [10.110.83.137] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Tue, 26 Oct 2021 12:33:49 -0700 Subject: Re: [PATCH] bitmap: simplify GENMASK(size - 1, 0) lines To: Andy Shevchenko , Yury Norov CC: Rasmus Villemoes , References: <20211026144108.35373-1-quic_qiancai@quicinc.com> From: Qian Cai Message-ID: <397751ea-536b-af3c-752d-c4b1045e6e56@quicinc.com> Date: Tue, 26 Oct 2021 15:33:48 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.