From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263594AbTDYSTF (ORCPT ); Fri, 25 Apr 2003 14:19:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263617AbTDYSTF (ORCPT ); Fri, 25 Apr 2003 14:19:05 -0400 Received: from chaos.analogic.com ([204.178.40.224]:8843 "EHLO chaos.analogic.com") by vger.kernel.org with ESMTP id S263594AbTDYSTE (ORCPT ); Fri, 25 Apr 2003 14:19:04 -0400 Date: Fri, 25 Apr 2003 14:30:51 -0400 (EDT) From: "Richard B. Johnson" X-X-Sender: root@chaos Reply-To: root@chaos.analogic.com To: Bill Davidsen cc: Timothy Miller , Chuck Ebbert <76306.1226@compuserve.com>, Jens Axboe , linux-kernel Subject: Re: [PATCH] 2.4.21-rc1 pointless IDE noise reduction In-Reply-To: Message-ID: References: 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 On Fri, 25 Apr 2003, Bill Davidsen wrote: > On Thu, 24 Apr 2003, Richard B. Johnson wrote: > > > > > Two alternatives: > > > > > > (a) !!(x & 0x400) > > > > > > (b) (x & 0x400) >> 10 > > > > > > > I meant return ((foo & MASK) && 1); > > > > Try it, you'll like it! No shifts, no jumps. > > Sorry, I still find !!(foo & MASK) easier to read, because !! is only used > to convert to boolean. Sort of a "boolean cast" in effect. It jumps out at > you what is intended. > > Anyway, a matter of taste, both generate jumpless code. Yes, you win. This looks good, both as code and as op-codes on Intel... #include int main() { int i; int mask = 0x40; for(i=0; i< 0x1000; i++) printf("%08x\n", !!(i & mask)); } You need to actually change something, hense the for() loop. Otherwise gcc just optimizes everything to a 1! Cheers, Dick Johnson Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips). Why is the government concerned about the lunatic fringe? Think about it.