[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH][for-4.19 v4 1/8] xen/include: add macro ISOLATE_LOW_BIT


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 30 Oct 2023 16:40:59 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h/kTTMUA2mt3NDEF9ck1clRnQLEoedrAA3H4nH1t4rw=; b=oFdV9LqcFjlju/7YY0/10CzvRYH0WlE9GSTYjaljmqLMTHrEG7/cfSNv3Fzr2W15xqZCsxzGhv0BCdY8LYrFYxuwJ0z9QABBkS4y+XdczSCmiwZ/t6FjwbaAGb8zx7k+krKLzaHhu9JOlIlURZgBfcf0RuMXLend/hMuhp+nbmeUTWLwxLOVOkoapAQZqwUxTrYF4PnaHXFSKPoZMuP0kcp68OceRBr+RbJ3gBTOKYCZFQbBS2PRtH9Iv1tsIMrwNmzFw824xSfJyx8S7J5dnkjhzvBVy8Wc0CcgoP2/qqBFVO93DXS/u8KVw+wlo1js2MzNG4mb4LYpxSJnyPSrbQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L0nNTU9PbIjtIfc4ZSPhN/TcZ6YbRPXvTH4CnCuwiXKkq+9GPW7yFTzPe2E0aK3oOiJf4An5a85yiQwH644cg9zEKPqvP9v8YANln1cwNPqb7kIjNzMt9AjZVL6+Ittw37C8HqCTHpnM+rf2nkgevZ92mDxRgWwMSCw9p0kKL1ymKAMdAbSzlGKevKXp8FJ+v/8gUJgH+wZ6Rc2GIf4YI+ttnJVqsZbobvRpZEyW9BPURMtFKhTU1f7t+bkU9IYZv7kMBpR94jGjQEBdDpWxBHVFamyFbj6lTcEWtjy7FA4WOn61F4Jwwy5Vo/2yaqNFLqfmYN8d9WfTehQRQ1rq+Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>, Doug Goldstein <cardoe@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 30 Oct 2023 15:41:08 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.10.2023 15:34, Nicola Vetrini wrote:
> --- a/xen/include/xen/macros.h
> +++ b/xen/include/xen/macros.h
> @@ -8,8 +8,14 @@
>  #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))
> +/*
> + * Given an unsigned integer argument, expands to a mask where just the least
> + * significant nonzero bit of the argument is set, or 0 if no bits are set.
> + */
> +#define ISOLATE_LOW_BIT(x) ((x) & -(x))

Not even considering future Misra changes (which aiui may require that
anyway), this generalization of the macro imo demands that its argument
now be evaluated only once.

Also another thought regarding the name: Would ISOLATE_LSB() be acceptable
to everyone having voiced a view on the set of proposed names? It would be
at least a little shorter ...

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.