Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932291AbVJKTNl (ORCPT ); Tue, 11 Oct 2005 15:13:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932326AbVJKTNl (ORCPT ); Tue, 11 Oct 2005 15:13:41 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:484 "HELO iolanthe.rowland.org") by vger.kernel.org with SMTP id S932291AbVJKTNl (ORCPT ); Tue, 11 Oct 2005 15:13:41 -0400 Date: Tue, 11 Oct 2005 15:13:39 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: "linux-os (Dick Johnson)" cc: Paul Jackson , , , , , , , , Subject: Re: [linux-usb-devel] Re: [BUG/PATCH/RFC] Oops while completing async USB via usbdevio In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1569 Lines: 46 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/