All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Julien Grall <julien@xen.org>
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, andrew.cooper3@citrix.com,
	roger.pau@citrix.com,
	Simone Ballarin <simone.ballarin@bugseng.com>,
	Doug Goldstein <cardoe@cardoe.com>,
	George Dunlap <george.dunlap@citrix.com>, Wei Liu <wl@xen.org>
Subject: Re: [XEN PATCH][for-4.19 v3 1/8] xen/include: add macro LOWEST_BIT
Date: Mon, 23 Oct 2023 09:31:05 +0200	[thread overview]
Message-ID: <d090c8bd9aaeda74938a8f47d3ddd1a1@bugseng.com> (raw)
In-Reply-To: <75deb3bc-1115-42eb-a629-defb09991074@xen.org>

On 20/10/2023 19:03, Julien Grall wrote:
> Hi Nicola,
> 
> On 20/10/2023 16:28, Nicola Vetrini wrote:
>> diff --git a/xen/include/xen/macros.h b/xen/include/xen/macros.h
>> index d0caae7db298..49f3ebf848e9 100644
>> --- a/xen/include/xen/macros.h
>> +++ b/xen/include/xen/macros.h
>> @@ -8,8 +8,11 @@
>>   #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))
>> +/* Returns the 2^ffs(x) or 0, where ffs(x) is the index of the lowest 
>> set bit */
>> +#define LOWEST_BIT(x) ((x) & -(x))
>> +
>> +#define MASK_EXTR(v, m) (((v) & (m)) / LOWEST_BIT(m))
>> +#define MASK_INSR(v, m) (((v) * LOWEST_BIT(m)) & (m))
>>     #define count_args_(dot, a1, a2, a3, a4, a5, a6, a7, a8, x, ...) x
>>   #define count_args(args...) \
>> diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
>> index aea259db1ef2..23cad71c8a47 100644
>> --- a/xen/include/xen/types.h
>> +++ b/xen/include/xen/types.h
> 
> I don't understand how the changes in this file are related to the
> commit. Did you intend to create a separate commit?
> 
> The rest LGTM.
> 

Oh, I made a mistake. This hunk should have been part of patch 7 as a 
cleanup.
I can resubmit with this removed, or it could be ignored altogether.

>> @@ -31,9 +31,9 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
>>   #define NULL ((void*)0)
>>   #endif
>>   -#define INT8_MIN        (-127-1)
>> -#define INT16_MIN       (-32767-1)
>> -#define INT32_MIN       (-2147483647-1)
>> +#define INT8_MIN        (-127 - 1)
>> +#define INT16_MIN       (-32767 - 1)
>> +#define INT32_MIN       (-2147483647 - 1)
>>     #define INT8_MAX        (127)
>>   #define INT16_MAX       (32767)
>> @@ -43,10 +43,10 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
>>   #define UINT16_MAX      (65535)
>>   #define UINT32_MAX      (4294967295U)
>>   -#define INT_MAX         ((int)(~0U>>1))
>> +#define INT_MAX         ((int)(~0U >> 1))
>>   #define INT_MIN         (-INT_MAX - 1)
>>   #define UINT_MAX        (~0U)
>> -#define LONG_MAX        ((long)(~0UL>>1))
>> +#define LONG_MAX        ((long)(~0UL >> 1))
>>   #define LONG_MIN        (-LONG_MAX - 1)
>>   #define ULONG_MAX       (~0UL)
>> 
> 
> Cheers,

-- 
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)


  reply	other threads:[~2023-10-23  7:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 15:28 [XEN PATCH][for-4.19 v3 0/8] address violations of MISRA C:2012 Rule 10.1 Nicola Vetrini
2023-10-20 15:28 ` [XEN PATCH][for-4.19 v3 1/8] xen/include: add macro LOWEST_BIT Nicola Vetrini
2023-10-20 17:03   ` Julien Grall
2023-10-23  7:31     ` Nicola Vetrini [this message]
2023-10-23  7:48   ` Jan Beulich
2023-10-23  9:19     ` Nicola Vetrini
2023-10-23 13:19       ` Nicola Vetrini
2023-10-23 13:45         ` Jan Beulich
2023-10-23 20:44           ` Stefano Stabellini
2023-10-24  6:14             ` Jan Beulich
2023-10-25 14:50               ` Nicola Vetrini
2023-10-25 15:33                 ` Jan Beulich
2023-10-25 22:38                   ` Stefano Stabellini
2023-10-26  6:52                     ` Jan Beulich
2023-10-26 10:32                       ` Nicola Vetrini
2023-10-26 11:37                         ` Julien Grall
2023-10-26 23:02                           ` Stefano Stabellini
2023-10-20 15:28 ` [XEN PATCH][for-4.19 v3 2/8] arm/bitops: encapsulate violation of MISRA C:2012 Rule 10.1 Nicola Vetrini
2023-10-20 15:28 ` [XEN PATCH][for-4.19 v3 3/8] xen/pdx: amend definition of PDX_GROUP_COUNT Nicola Vetrini
2023-10-20 15:28 ` [XEN PATCH][for-4.19 v3 4/8] x86_64/mm: express macro CNT using LOWEST_BIT Nicola Vetrini
2023-10-20 15:28 ` [XEN PATCH][for-4.19 v3 5/8] x86/io_apic: address violation of MISRA C:2012 Rule 10.1 Nicola Vetrini
2023-10-23 15:39   ` Jan Beulich
2023-10-20 15:28 ` [XEN PATCH][for-4.19 v3 6/8] x86/mce: Move MC_NCLASSES into the enum mctelem_class Nicola Vetrini
2023-10-20 15:28 ` [XEN PATCH][for-4.19 v3 7/8] xen/types: address Rule 10.1 for DECLARE_BITMAP use Nicola Vetrini
2023-10-23 22:55   ` Stefano Stabellini
2023-10-20 15:28 ` [XEN PATCH][for-4.19 v3 8/8] xen/compat: use BUILD_BUG_ON in CHECK_SIZE macros Nicola Vetrini
2023-10-23 13:19   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d090c8bd9aaeda74938a8f47d3ddd1a1@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=cardoe@cardoe.com \
    --cc=consulting@bugseng.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=simone.ballarin@bugseng.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xenia.ragiadakou@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.