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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9093BE95A8E for ; Mon, 9 Oct 2023 07:08:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.614184.955148 (Exim 4.92) (envelope-from ) id 1qpkNc-0002dS-2i; Mon, 09 Oct 2023 07:08:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 614184.955148; Mon, 09 Oct 2023 07:08:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qpkNc-0002dL-09; Mon, 09 Oct 2023 07:08:40 +0000 Received: by outflank-mailman (input) for mailman id 614184; Mon, 09 Oct 2023 07:08:39 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qpkNb-0002dF-LH for xen-devel@lists.xenproject.org; Mon, 09 Oct 2023 07:08:39 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id aadcb673-6672-11ee-9b0d-b553b5be7939; Mon, 09 Oct 2023 09:08:37 +0200 (CEST) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id EB8E64EE073F; Mon, 9 Oct 2023 09:08:36 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: aadcb673-6672-11ee-9b0d-b553b5be7939 MIME-Version: 1.0 Date: Mon, 09 Oct 2023 09:08:36 +0200 From: Nicola Vetrini To: andrew.cooper3@citrix.com Cc: xen-devel@lists.xenproject.org, sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, roger.pau@citrix.com, Simone Ballarin , Doug Goldstein , George Dunlap , Julien Grall , Wei Liu Subject: Re: [XEN PATCH][for-4.19 1/9] xen/include: add macro LOWEST_POW2 In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.3 Message-ID: X-Sender: nicola.vetrini@bugseng.com Organization: BUGSENG s.r.l. Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On 06/10/2023 18:35, andrew.cooper3@citrix.com wrote: > On 06/10/2023 9:26 am, Nicola Vetrini wrote: >> diff --git a/xen/include/xen/macros.h b/xen/include/xen/macros.h >> index d0caae7db298..bb9a1c9a53d0 100644 >> --- a/xen/include/xen/macros.h >> +++ b/xen/include/xen/macros.h >> @@ -8,8 +8,10 @@ >> #define DIV_ROUND(n, d) (((n) + (d) / 2) / (d)) >> #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) >> >> -#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m))) >> -#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m)) >> +#define LOWEST_POW2(x) ((x) & -(x)) > > Naming wise, LOWEST_BIT() please. > > The fact it's a power of two is incidental, and POW2 is ambiguous, > because it includes interpretations such as "calculate the lowest power > of two greater than x". > > ~Andrew You have a point. I'll change it. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)