lkml.org 
[lkml]   [2020]   [May]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 4.19 28/37] dmaengine: dmatest: Fix iteration non-stop logic
On Tue, May 5, 2020 at 3:37 PM Pavel Machek <pavel@denx.de> wrote:
> > So, to the point, the conditional of checking the thread to be stopped being
> > first part of conjunction logic prevents to check iterations. Thus, we have to
> > always check both conditions to be able to stop after given
> > iterations.
>
> I ... don't understand. AFAICT the code is equivalent. Both && and ||
> operators permit "short" execution... but second part of expression
> has no sideeffects, so...

..

> You are changing !a & !b into !(a | b). But that's equivalent
> expression. I hate to admit, but I had to draw truth table to prove
> that.
>
> !a & !b 0 0 -> 1
> else -> 0
>
> !(a | b) 0 0 -> 1
> else -> 0
>
> What am I missing?

Basic stuff. Compiler doesn't consider second part of conjunction when
first one (see operator precedence) is already false, so, it means:

a & b
0 x -> false
1 0 -> false
1 1 -> true

x is not being considered at all. So, logically it's equivalent,
run-time it's not.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2020-05-05 14:52    [W:0.070 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site