[lkml]   [2003]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Multiple & vs. && and | vs. || bugs in 2.4.20
Ulrich Drepper wrote:
> > - if (!urb->status & !acm->throttle) {
> > + if (!urb->status && !acm->throttle) {
> Have you really looked at detail at all these cases? The problem is
> that you have made the code less efficient on some platforms. The use
> of && requires shortcut evaluation. I.e., the compiler is forced to not

While I agree with your observation in general, this is actually
something the compiler should be able to figure out by itself:

- there's only a side-effect if acm is NULL
- in ACM_READY, we've already tested acm for NULL, and subsequently
de-referenced it
- acm is a local variable, and not aliased, so the dbg() can't
change it

So, given the negations, || and | are equivalent in this case, and
whether a jump, conditional execution, a bit operation, or something
else yields better code is compiler, machine, and context specific.

- Werner

/ Werner Almesberger, Buenos Aires, Argentina /
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:33    [W:0.089 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site