Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: kogge-stone, rotated bitboards, "raytracing" - on 32 or 64-bit platforms

Author: Zach Wegner

Date: 10:16:11 09/25/04

Go up one level in this thread


On September 25, 2004 at 06:21:13, martin fierz wrote:

>1) does anybody here have an idea how these 3 ways of generating attacks for
>sliders compare speedwise for both 32-bit and 64-bit processors? (reason: if
>kogge-stone will be comparable to rotated bitboards, i'd rather not bother to
>implement rotated bitboards, and if both are not much better than my current
>code, i'd also rather not bother with a rewrite).
>

On 32 bit processors (using only 32 bit instructions, no MMX) rotated should be
a little faster. On 64 bits, I'm not so sure but the gap should narrow (or
kogge-stone might be faster). Both of these are probably a lot faster than your
method.

>2) in the code above, to make things more readable and compact i could write
>functions like this (same for kogge-stone):
>
>forwardattack(org, empty)
>  {
>  int64 attack;
>  x = forward(org); // x traces a ray forward; forward(x) is a macro
>                    // forward(x) <--> (x = x<<8);
>  while(x & empty)
>    {
>    attack |= x;
>    x = forward(x);
>    }
>  return attack;
>  }
>
>and then put together my rook attack function as
>
>for-all-rooks-do...
>  attack =
>forwardattack(rooksquare)|backwardattack(rooksquare)|leftattack(rooksquare)|rightattack(rooksquare);
>
>this would be much much cleaner instead of writing out the code all the time for
>all attackers.
>
>question: would that be slower than writing it out? will the compiler inline
>such functions anyway?

It should be inlined. This is a good idea.
>
>3) the ray-tracing method is probably slower, but one of the benefits is that
>you can continue ray-tracing once you hit an occupied square, so you can get
>pins or x-ray-attacks. i don't see how to get such attacks easily in rotated
>bitboard or kogge-stone formalism. am i missing something?

Well, you could get the attacks in the same direction from the square of the
attacked piece. I don't think ray-tracing would be any faster here.

>
>cheers
>  martin

Zach



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.