Re: [linux-usb-devel] Re: [BUG/PATCH/RFC] Oops while completingasync USB via usbdevio

From: Alan Stern
Date: Tue Oct 11 2005 - 14:14:02 EST


On Tue, 11 Oct 2005, linux-os (Dick Johnson) wrote:

> On Tue, 11 Oct 2005, Paul Jackson wrote:
>
> > Alan asked:
> >> But why do people go to the
> >> effort of confusing readers by using "^" instead of "!="?
> >
> > My guess - eor (^) was quicker than not-equal (!=) on a PDP-11.
> >
> > That code fragment for checking uid's has been around a -long-
> > time, if my memory serves me.
> >
> > It's gotten to be like the infamous "!!" boolean conversion
> > operator, a bit of vernacular that would be harder to read if
> > recoded using modern coding style.

Surely Linux uses entirely original code, with no hangovers from the
original AT&T Unix... Besides, to the best of my recollection, the two
operations are equal in speed on a PDP-11.

"!!" makes sense as an idiom. But "^" for "!=" doesn't, at least not in
this context.

> Also, at one time, people used to spend a lot of time
> minimizing the number of CPU cycles used in the code.
>
> For instance, when it's appropriate, using XOR makes the
> resulting generated code simpler and usually faster:
...

Yes, sometimes XOR can yield simpler object code. But not in cases like
this, where it's part of a Boolean test:

if (... && (a1^b1) && (a2^b2) && (a3^b3)) ...

On any architecture I know of, "^" and "!=" would be equally efficient
here.

Alan Stern

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/