Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: Terje Mathisen <terje.mathisen@hda.hydro.com>
Subject: Re: Can POWER4, 5 etc continue where Alpha was stopped?
Date: Wed, 29 Aug 2001 08:25:08 +0200	[thread overview]
Message-ID: <3B8C8AC4.59ED22CB@hda.hydro.com> (raw)
In-Reply-To: 9mhbh0$pbq$1@ausnews.austin.ibm.com

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.

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"


  parent reply	other threads:[~2001-08-29  6:25 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 [this message]
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
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