linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Bill Davidsen <davidsen@tmr.com>
Cc: Timothy Miller <miller@techsource.com>,
	Chuck Ebbert <76306.1226@compuserve.com>,
	Jens Axboe <axboe@suse.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] 2.4.21-rc1 pointless IDE noise reduction
Date: Fri, 25 Apr 2003 14:30:51 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.53.0304251429020.7388@chaos> (raw)
In-Reply-To: <Pine.LNX.3.96.1030425141133.16623E-100000@gatekeeper.tmr.com>

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 <stdio.h>
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.


  reply	other threads:[~2003-04-25 18:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-24 15:25 [PATCH] 2.4.21-rc1 pointless IDE noise reduction Chuck Ebbert
2003-04-24 15:59 ` Richard B. Johnson
2003-04-24 16:31   ` Timothy Miller
2003-04-24 16:46     ` Richard B. Johnson
2003-04-24 17:15       ` Timothy Miller
2003-04-24 18:27         ` Willy Tarreau
2003-04-24 19:00           ` Timothy Miller
2003-04-25 18:14       ` Bill Davidsen
2003-04-25 18:30         ` Richard B. Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-04-24 23:25 Chuck Ebbert
2003-04-25 15:08 ` Timothy Miller
2003-04-24  9:34 Erik Andersen
2003-04-24 10:28 ` Jens Axboe
2003-04-27 12:21 ` Adrian Bunk
2003-04-27 17:44   ` Erik Andersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.53.0304251429020.7388@chaos \
    --to=root@chaos.analogic.com \
    --cc=76306.1226@compuserve.com \
    --cc=axboe@suse.de \
    --cc=davidsen@tmr.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miller@techsource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).