Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp274521pxb; Wed, 27 Oct 2021 02:50:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtx6B2Qfaog+KI/fYZZTCN55oMFl+C8b20qv62AlzThOgjadINEuxDOwADF1rqXjGiurYD X-Received: by 2002:a17:906:70c5:: with SMTP id g5mr38487428ejk.63.1635328243767; Wed, 27 Oct 2021 02:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635328243; cv=none; d=google.com; s=arc-20160816; b=WNhTV4EyOwtYQrBKS8hVGm3gb+zsMHfYH3NX8Ai+Sq6KjcF1vfZcx5Cfh8Z3YGB43P skTIcvdkK1/SwfrsBXbBD9xxB8ZMky6QL2JCNUlfoQE8k8pwuYKT79F2ax2uLIpG5a/1 ZKsIEIG3q7SbEuF0oKQb9v6fvYjHlUgMg4EvkIpIW9FdY+3MtS9yKer4BYs09KvLL8Ma ZLapfuoGAewF566qyrroR8zD636w3H1ofCss/q7/TXOsJkw5feI0Xobs0//vzanfIRJh 0CihSo4DLQJqYUhMMi+oJXqRvMgDe8UHYJLNeCdt+qGduAcykn+45gF717+urk64VVat x5+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=luxtlj1Y6uRTaP9b8yBJzpsSMZuh+ycQHMse587VUzI=; b=Gw0cgjpWcgZ0tvdKPNx7EuibgevloTlaZO9rMake/6AEO6vk5j122GKTykYHxhO/U+ NfbUEv4ojXn9uDVoo7gVjFReiSQBFOV0DpisD+1HBPIfewwbIkQa8CYo5eWCZE2MqyN2 hPgIoLHUwg2Kmto2bWhwpNT/4esX9zT2tout8ksD8draoYYy65ieDjXDV4AffbZFiO/z LLJv9InBLcEXTQS8X70PfVjHRusFhGM5mnjhknfDy8SeS6b0ESQK0RT6QO5KjjN5dztH TXl3TelexsikGRIZ/RLi+o3MoHT4DmMns7z+QalL4sYXzTSn8JU3+3L5Ij4c11R1X4DV neXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=x0p5veDm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sc14si13021139ejc.119.2021.10.27.02.49.34; Wed, 27 Oct 2021 02:50:43 -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; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=x0p5veDm; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238807AbhJZTgT (ORCPT + 99 others); Tue, 26 Oct 2021 15:36:19 -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.