[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87il3cjwsm.fsf@intel.com>
Date: Mon, 29 Jan 2024 11:47:37 +0200
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: David Laight <David.Laight@...LAB.COM>, "'linux-kernel@...r.kernel.org'"
<linux-kernel@...r.kernel.org>, 'Linus
Torvalds' <torvalds@...ux-foundation.org>, 'Netdev'
<netdev@...r.kernel.org>, "'dri-devel@...ts.freedesktop.org'"
<dri-devel@...ts.freedesktop.org>
Cc: 'Jens Axboe' <axboe@...nel.dk>, "'Matthew Wilcox (Oracle)'"
<willy@...radead.org>, 'Christoph Hellwig' <hch@...radead.org>,
"'linux-btrfs@...r.kernel.org'" <linux-btrfs@...r.kernel.org>, 'Andrew
Morton' <akpm@...ux-foundation.org>, 'Andy Shevchenko'
<andriy.shevchenko@...ux.intel.com>, "'David S . Miller'"
<davem@...emloft.net>, 'Dan Carpenter' <dan.carpenter@...aro.org>
Subject: RE: [PATCH next 10/11] block: Use a boolean expression instead of
max() on booleans
On Mon, 29 Jan 2024, David Laight <David.Laight@...LAB.COM> wrote:
> From: Jani Nikula
>> Sent: 29 January 2024 09:08
>>
>> On Sun, 28 Jan 2024, David Laight <David.Laight@...LAB.COM> wrote:
>> > blk_stack_limits() contains:
>> > t->zoned = max(t->zoned, b->zoned);
>> > These are bool, so it is just a bitwise or.
>>
>> Should be a logical or, really. And || in code.
>
> Not really, bitwise is fine for bool (especially for 'or')
> and generates better code.
Logical operations for booleans are more readable for humans than
bitwise. And semantically correct.
With a = b || c you know what happens regardless of the types in
question. a = b | c you have to look up the types to know what's going
on.
To me, better code only matters if it's a hotpath.
That said, not my are of maintenance, so *shrug*.
BR,
Jani.
--
Jani Nikula, Intel
Powered by blists - more mailing lists