From: David Laight <David.Laight@ACULAB.COM>
To: 'Mahmoud Maatuq' <mahmoudmatook.mm@gmail.com>,
"keescook@chromium.org" <keescook@chromium.org>,
"edumazet@google.com" <edumazet@google.com>,
"willemdebruijn.kernel@gmail.com"
<willemdebruijn.kernel@gmail.com>,
"wad@chromium.org" <wad@chromium.org>,
"luto@amacapital.net" <luto@amacapital.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"shuah@kernel.org" <shuah@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"linux-kselftest@vger.kernel.org"
<linux-kselftest@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>
Cc: "linux-kernel-mentees@lists.linuxfoundation.org"
<linux-kernel-mentees@lists.linuxfoundation.org>
Subject: RE: [PATCH v2 2/2] selftests/net: replace ternary operator with min()/max()
Date: Fri, 25 Aug 2023 09:32:02 +0000 [thread overview]
Message-ID: <dd7b956916e044b181e7ccd1823f14ec@AcuMS.aculab.com> (raw)
In-Reply-To: <20230824202415.131824-2-mahmoudmatook.mm@gmail.com>
From: Mahmoud Maatuq
> Sent: 24 August 2023 21:24
....
> tdeliver = glob_tstart + ts->delay_us * 1000;
> - tdeliver_max = tdeliver_max > tdeliver ?
> - tdeliver_max : tdeliver;
> + tdeliver_max = max(tdeliver_max, tdeliver);
That was spectacularly horrid...
What is wrong with using:
if (tdeliver > tdeliver_max)
tdeliver_max = tdeliver;
That is pretty obviously calculating the upper bound.
Even the version with max() needs extra parsing by the human reader.
(The only issue is whether it reads better with the if condition
reversed.)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2023-08-25 9:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-24 20:24 [PATCH v2 1/2] selftests: Provide local define of min() and max() Mahmoud Maatuq
2023-08-24 20:24 ` [PATCH v2 2/2] selftests/net: replace ternary operator with min()/max() Mahmoud Maatuq
2023-08-24 20:32 ` Willem de Bruijn
2023-08-24 21:13 ` [PATCH v2 2/2] selftests/net: replace ternary operator with min()/max() ^[^[ Mahmoud Matook
2023-08-24 21:22 ` [PATCH v2 2/2] selftests/net: replace ternary operator with min()/max() Willem de Bruijn
2023-08-25 9:32 ` David Laight [this message]
2023-08-25 15:26 ` [PATCH v2 1/2] selftests: Provide local define of min() and max() Sean Christopherson
2023-08-26 9:45 ` Mahmoud Matook
2023-08-28 15:04 ` Sean Christopherson
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=dd7b956916e044b181e7ccd1823f14ec@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mahmoudmatook.mm@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=wad@chromium.org \
--cc=willemdebruijn.kernel@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox