Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: BitScan with reset - not so impressive with 3DNow!

Author: Gerd Isenberg

Date: 14:00:45 12/03/02

Go up one level in this thread


Hi Miguel,

interesting serialisation approach. Soo many ways to Rome ;-)

Some thoughts:

Even if the instructions are cheap, you obviously run for every set bit through
the inner loop, where the *ps++ = r | c; instruction occurs. Also it seems the
runtime of your loops depend on the bit-positions (eg. bit 0 terminates earlier
than bit 31 if they are exclusively set in one 32bit-word).

Next point is you write terminated square arrays into memory, and you have to
traverse this arrays later, looking for the terminator, or do i miss something?
So you need a second, but of course cheaper loop.

If i look to Walters routine, so few instructions to get a bit index, i believe
this direct bitscan approach is cheaper. Also the outer control structure seems
IMHO easier and more readable, but that may be a matter of taste.

while (bb)
   doSomething( bitSearchAndReset(bb) );


If i would do it in that way, your approach may preferable:

int squares[64+1];
for (int i=0; bb; ++i)
   squares[i] = bitSearchAndReset(bb);
squares[i] = 0;
for (int i=0; squares[i]; ++i)
    doSomething( squares[i] );

Anyway, interesting algorithm to get the square indicies, thanks for sharing.

Regards,
Gerd



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.