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

Re: [PATCH] x86/bitops: drop redundant casts from find_next{,_zero}_bit()


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 19 Feb 2026 15:48:53 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JyjrtDo9AUUHIM3v5wCgL2KMCGQ4WXnlCVyWZaI5os0=; b=uUmrNTN3dAqIG2Rvdme4wl6hw4BzohsnOzvdOMdwl4fAbS1BmszRJJyUesdY1o1TV/d2H998ksJB78X/8f7nXpsztm71rJ+9Hnu0DXpcCACVCQ0sqreKM68kxhXljLKQLlTOZgR/VTQE3rvyJzFx2YTJ9UhD4Ne/M+XZ1U8OGRzDEc4+1qCX7KKssg7dj9zRUxxlpZG7v353x1XZVKUQ6imts9TtvZGQBIoY2ihJPDowt6KrNExlGN36bFBPTmNGxb2gT+00NnilgjwmF0cH47BC+DKoJdwC411g0RTVnmvmbCHfswWC04BLEhfAF+txEMitxFm+LzJo50mMWy4IqA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hV2MPhEs6XglaQ4OHllAdvNY6zZXj+PlS1JqM4CtCr97nAThkYTQUxb/GW3Uy2W4crmTLb6RHky3wP7DVNqLUG0+9aXPy6FC3NyVbCCGBY/2WU3LhlnkWdWwVDIk9k5XZFOXn6AvwsrFpiTleeWMuE7ujNmj4Pq3Z4Ev1OpK4b+PlAgq2pYEzaQQehQLg3Qk/IKOe9JNxh/7NJCJCMIFTqUUpftw3aJemcPpftYqjsAe1iuMxfhjjTlwFTJMB+0Dm+7LyCfTgso416hC1+WPR/P6PL1KTMl0Qb2ScIxdxcu11O+A1fVzkNq3pyDts0Woo4CAK3ATWS6gMIzdSsSnww==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 19 Feb 2026 15:49:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19/02/2026 3:43 pm, Jan Beulich wrote:
> It's not clear why they were put in place - a__ is of the very type
> already.
>
> No change in generated code.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

I recall this monstrosity requiring many edits to get right.  I expect
it's stale from an older form.

Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

>
> --- a/xen/arch/x86/include/asm/bitops.h
> +++ b/xen/arch/x86/include/asm/bitops.h
> @@ -343,7 +343,7 @@ static always_inline unsigned int __scan
>      if ( o__ >= s__ )                                                       \
>          r__ = s__;                                                          \
>      else if ( __builtin_constant_p(size) && s__ <= BITS_PER_LONG )          \
> -        r__ = o__ + __scanbit(*(const unsigned long *)(a__) >> o__, s__);   \
> +        r__ = o__ + __scanbit(*a__ >> o__, s__);                            \
>      else if ( __builtin_constant_p(off) && !o__ )                           \
>          r__ = __find_first_bit(a__, s__);                                   \
>      else                                                                    \
> @@ -375,7 +375,7 @@ static always_inline unsigned int __scan
>      if ( o__ >= s__ )                                                       \
>          r__ = s__;                                                          \
>      else if ( __builtin_constant_p(size) && s__ <= BITS_PER_LONG )          \
> -        r__ = o__ + __scanbit(~*(const unsigned long *)(a__) >> o__, s__);  \
> +        r__ = o__ + __scanbit(~*a__ >> o__, s__);                           \
>      else if ( __builtin_constant_p(off) && !o__ )                           \
>          r__ = __find_first_zero_bit(a__, s__);                              \
>      else                                                                    \




 


Rackspace

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