From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 115614,e489d6e4973d889f X-Google-Attributes: gid115614,public X-Google-Thread: 102b75,e489d6e4973d889f X-Google-Attributes: gid102b75,public X-Google-Thread: 1164f8,e489d6e4973d889f X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 2001-08-28 20:31:48 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!enews.sgi.com!news.xtra.co.nz!newsfeeds.ihug.co.nz!lust.ihug.co.nz!ihug.co.nz!bruce From: Bruce Hoult Newsgroups: comp.arch,comp.sys.dec,comp.unix.aix Subject: Re: Can POWER4, 5 etc continue where Alpha was stopped? Date: Wed, 29 Aug 2001 03:27:56 +1200 Organization: ihug ( New Zealand ) Message-ID: References: <88525dde.0108260914.7c63d8c3@posting.google.com> <9mgps0$12ee$1@ausnews.austin.ibm.com> <9mhbh0$pbq$1@ausnews.austin.ibm.com> NNTP-Posting-Host: p11-max8.wlg.ihug.co.nz X-Trace: lust.ihug.co.nz 999055907 8045 203.173.231.203 (29 Aug 2001 03:31:47 GMT) X-Complaints-To: abuse@ihug.co.nz NNTP-Posting-Date: Wed, 29 Aug 2001 03:31:47 +0000 (UTC) User-Agent: MT-NewsWatcher/3.0 (PPC) Xref: archiver1.google.com comp.arch:15885 comp.sys.dec:6758 comp.unix.aix:22683 In article <9mhbh0$pbq$1@ausnews.austin.ibm.com>, mccalpin@gmp246.austin.ibm.com (McCalpin) wrote: > In article , > Bruce Hoult 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 wouldn't want to see it uncommented somewhere, but it's a perfectly fine thing to have smewhere in an (inline) function called IsPowerOfTwo(). -- Bruce