[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <57815326-740d-4053-8b85-c5e57d7cec90@wanadoo.fr>
Date: Thu, 26 Jun 2025 18:23:06 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: Markus Elfring <Markus.Elfring@....de>, linux-can@...r.kernel.org
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
Chen Ni <nichen@...as.ac.cn>, Marc Kleine-Budde <mkl@...gutronix.de>
Subject: Re: can: ucan: Use usb_endpoint_type() rather than duplicating its
implementation
On 26/06/2025 at 16:22, Markus Elfring wrote:
>>> I am unsure if the check reordering would be desirable for this function implementation.
>>
>> Ah, you want to confirm whether
>>
>> usb_endpoint_dir_in(ep) && usb_endpoint_xfer_bulk(ep)
>>
>> is the same as
>>
>> usb_endpoint_xfer_bulk(ep) && usb_endpoint_dir_in(ep)
>>
>> ?
>
> Exactly, yes.
>
> Commutativity can probably be applied in this case.
> But the different execution order will influence the corresponding run time characteristics.
> https://en.wikipedia.org/wiki/Short-circuit_evaluation
> https://en.wikipedia.org/wiki/Commutative_property
>
> The data processing order from known API function implementations might get priority
> also at discussed source code places in the near future.
Yes. This is what I tried to explain in my previous message: that the short
circuit evaluation may impact the result when there is an undefined behaviour
but that it is not the case here.
Yours sincerely,
Vincent Mailhol
Powered by blists - more mailing lists