From: name99@mac.com (Maynard Handley)
Subject: Re: Can POWER4, 5 etc continue where Alpha was stopped?
Date: Wed, 29 Aug 2001 14:45:22 -0700 [thread overview]
Message-ID: <name99-2908011445220001@handma2.apple.com> (raw)
In-Reply-To: 3B8C8AC4.59ED22CB@hda.hydro.com
In article <3B8C8AC4.59ED22CB@hda.hydro.com>, Terje Mathisen
<terje.mathisen@hda.hydro.com> wrote:
> McCalpin wrote:
> >
> > In article <bruce-AD55D9.22144128082001@news.akl.ihug.co.nz>,
> > Bruce Hoult <bruce@hoult.org> wrote:
> > >In article <9mgps0$12ee$1@ausnews.austin.ibm.com>,
> > >mccalpin@austin.ibm.com wrote:
> > >
> > >> , and [I] have only found
> > >> one use for [pop count] in my own experience..... (It is a very easy way
> > >> to determine if an integer is a power of two -- though I don't
> > >> usually care about how long it takes to make this determination.)
> > >
> > >It's not needed for that -- (x & (x-1)) is zero IFF x is a power of two
> > >(or zero). It works by clearing the least significant set bit.
> >
> > Ouch -- that sort of bit twiddling makes my poor Fortran brain
> > hurt. I hate it when I run across coding like this.
> >
> > >I'm sure you knew this.
> >
> > I did not know it, but I am trying to forget it as fast as I can!
>
> Why???
>
> Optimized code can indeed make use of a fast way to determine if a
> number is a power of two, I've used that particular idiom several times.
I think the main thing is to ensure that things like this are wrapped in a
macro rather than directly in the code. Not only does that make the code
much easier to read but it allows one to restructure the macro if
appropriate to a new platform. (Unlikely for this example, but can be
likely in other situations eg when one moves from big to little-endian.)
Maynard
> popcount() is also useful, mostly when working with bitmaps.
>
> A possible use would be for SQL runtime optimization, when joining
> bitmaps to determine the best evaluation order.
>
> I suspect that NSA could use it as a quick way to detect patterns that
> significantly differ from purely random bitstreams?
>
> Terje
>
> --
> - <Terje.Mathisen@hda.hydro.com>
> Using self-discipline, see http://www.eiffel.com/discipline
> "almost all programming can be viewed as an exercise in caching"
next prev parent reply other threads:[~2001-08-29 21:45 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-26 17:14 Can POWER4, 5 etc continue where Alpha was stopped? Nova
2001-08-26 22:30 ` del cecchi
2001-08-28 17:39 ` Niels Jørgen Kruse
2001-08-28 18:47 ` Christer Palm
2001-08-28 20:00 ` Del Cecchi
2001-08-27 1:38 ` Robert Deininger
2001-08-27 17:12 ` Richard Tomkins
2001-08-28 19:02 ` McCalpin
2001-08-28 10:14 ` Bruce Hoult
2001-08-29 0:03 ` McCalpin
2001-08-28 15:27 ` Bruce Hoult
2001-08-29 6:25 ` Terje Mathisen
2001-08-29 11:48 ` George Coulouris
2001-08-29 17:30 ` Terje Mathisen
2001-08-29 19:32 ` Terje Mathisen
2001-08-29 21:45 ` Maynard Handley [this message]
2001-08-31 10:09 ` Terje Mathisen
2001-08-31 16:09 ` Serguei Patchkovskii
2001-09-01 19:51 ` Terje Mathisen
2001-08-28 20:38 ` Andi Kleen
2001-08-28 10:16 ` Bruce Hoult
2001-08-28 20:51 ` Nick Maclaren
2001-08-28 23:04 ` Andi Kleen
2001-08-29 7:59 ` Nick Maclaren
2001-08-30 20:18 ` Wow
2001-08-31 7:47 ` Terry C. Shannon
2001-08-31 9:09 ` Ketil Z Malde
2001-08-31 12:52 ` Terry C. Shannon
2001-08-31 13:14 ` McCalpin
2001-09-03 12:23 ` Alexis Cousein
2001-09-05 1:27 ` del cecchi
2001-09-05 2:07 ` Chris Morgan
2001-09-05 18:13 ` Del Cecchi
2001-09-05 18:57 ` Larry Kilgallen
2001-09-05 12:49 ` Sander Vesik
2001-09-05 14:17 ` McCalpin
2001-09-05 14:59 ` Michael Kraemer
2001-09-05 16:32 ` Pentyern
2001-09-06 0:32 ` del cecchi
2001-09-05 18:08 ` Terry C. Shannon
2001-09-06 13:42 ` Stefaan A Eeckels
2001-09-06 15:08 ` Alexis Cousein
2001-09-06 16:40 ` Mark Smotherman
2001-09-06 21:57 ` Stefaan A Eeckels
2001-09-07 16:22 ` Peter da Silva
2001-08-31 12:20 ` Nick Maclaren
2001-09-03 15:07 ` bad bob
2001-08-28 21:16 ` Greg Lindahl
2001-08-29 0:06 ` McCalpin
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox