[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 08:15:59 +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=sJF0+RYrUrsBk6SF7twEGkhRDSpxnS1tjodPwav43Ck=; b=XBe183Z9c385vV2/ll2Hu6KmxblDjhKh5A4xnfUKWJj8xQUzd4qLYzpNEcbEBMnqNwotlzMEL/3bILSNUIo/L9DvaY6SXto75CzS6wtMY07020Qh7lkkJzP8eCaymx/1FW3oI7Ono7fNVxVzjKKbBWV5eTyf379VIUp8yVv6y0OI+gT+oZsMYiHn9lg8i+O7o2xlcOw9sE9t3cuw+LUZ4SlIb+mN17EYVu7MHcHKm+Bx+5Z2oYs+O6gmQLH6VfkATQ+laX/2OFLlO5q4dRFo6akeIRByTMcb6y0PThpyUD2WdGH20+C7Sf5u783stsS2qHdzYRRg7oZcvehS6+3rfw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oOPe9Z1m83hDuQs34Z+/8xHn8yg3xSaUUYOBOrHyNd/9ubEO9+hC2av+tY079GX75mXvcb9F26hQIExmF1Md0nYABsfp4mW7yV2KwCodjGKttUCgfJFl+IH++ZUShILCq/stlbqx//G8xTtGcQlSHN61UQ9WTTSox/E3gaXoStWbUj2QAA3Jk7xKlc50hxLwX8Oa+mmcfD3u4ht69KLR9DvCxjFiXqsleJCEFfHsobAHWtLV4nGVbofuaixID3plwPRlFh9G/Onykc6GU6jVWhD9bD2CFBmqQm1xjQ7ww3uKriFyysNbQvQpm4NvtPPkBn/bbGQTVhycrhcZltQV+A==
- 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 06:16:09 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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.)
Jan
|