lkml.org 
[lkml]   [2005]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [linux-usb-devel] Re: [BUG/PATCH/RFC] Oops while completing async USB via usbdevio
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-10-11 21:16    [W:0.050 / U:7.840 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site