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

Re: [PATCH] x86: do away with HAVE_AS_NEGATIVE_TRUE


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 19 May 2023 16:04:52 +0200
  • 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=EkoE74H0DL22Rh4UD4F39wlDsfv/7WlSaI1htlhZv5A=; b=K/m3o13dwqsMg/A3+A8hN7crmYyHVWBjD4b3qCmsJbZJP/KkEJ0/QvTs5gKm21EaR4WJIo44MyHsHLLU3W2AzvTONcYnIbHA5p6w925huNbGe3Oo2IjbeB+FGaR0bjl4lGNGrubd829mDUa7/rR190TyibbPx3AnLajvWgLZrDQ87dkOup1Gto5i8cHMFCSz68eh9VbYuonZtAfubTv14gy530ddKvtoVXZM5MxQacyjICdrV7AC3n6HLSSxx9o+/lyaFEPu90zg99BAYnJO6kaAxiVRQfl6fa1PoCIWD9Oe6IHpuHF49UuJt0hkGhIPKFIsgo+v24m0nS1yUfobGA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TaEU7duZZ9+UvXnZ52YZBavccb0KJ5WmKBkimg6aVdvt2y+p2rHKOiPqaK4dVcgK6DKObgQQhQNjGdQHnCuKKjuYfe+b2/c8Y2qdTXr7p9KfGGDYL2tDNe0HIsHfhWtz7rlBe7EO/7l+B9MNIkfWxC8CqvPK3Fg4skuouIlOx1BoEiMxICu1v2QJ8TZpv9OgJCqt7j2m+20/tVWEL0nB2OWazfdge+xT6xh96awjRi/uc12exTXPsd/zCQwGTYBLMnKDyQ8uh0lNKgbt9Xeu0goy98IEhvPSzvo5A6TCeT8KrUu6o8OTChrs/TyMWvQnxR2iWbk88qdG8KnPmLLj5g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 19 May 2023 14:05:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.05.2023 08:15, Jan Beulich wrote:
> On 17.05.2023 19:05, Andrew Cooper wrote:
>> On 17/05/2023 3:22 pm, Jan Beulich wrote:
>>> There's no real need for the associated probing - we can easily convert
>>> to a uniform value without knowing the specific behavior (note also that
>>> the respective comments weren't fully correct and have gone stale). All
>>> we (need to) depend upon is unary ! producing 0 or 1 (and never -1).
>>>
>>> For all present purposes yielding a value with all bits set is more
>>> useful.
>>>
>>> No difference in generated code.
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>>> ---
>>> Unlike in C, there's also binary ! in assembly expressions, and even
>>> binary !!. But those don't get in the way here.
>>
>> I had been wanting to do this for a while, but IMO a clearer expression
>> is to take ((x) & 1) to discard the sign.
>>
>> It doesn't change any of the logic to use +1 (I don't think), and it's
>> definitely the more common way for the programmer to think.
> 
> Well, I can certainly switch. It simply seemed to me that with our many
> uses of !! elsewhere, using this here as well would only be consistent.
> (I did in fact consider the ... & 1 alternative.)

Before even starting with this - you do realize that the C macro
(AS_TRUE) expands to just a prefix for the expression to be dealt
with? That would then become "1 & ", which I have to admit I find
a little odd. The alternative of making this a more ordinary macro
(with a parameter) would likely be more intrusive. Plus I assume
you had a reason to do it the way it is right now (and I might end
up figuring that reason the hard way when trying to change things).

Jan



 


Rackspace

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