Author: Tony Werten
Date: 05:40:22 09/20/04
Go up one level in this thread
On September 20, 2004 at 02:23:59, Tony Werten wrote:
>It isn't doing things parallel like the sliders with Kogge Stone, but at least
>it doesn't use those big arrays.
>
>const KNIGHTC3 // all attacks of a knight on square C3
>
>pieces=BITBOARD[stm][KNIGHT];
>attacks=0;
>while (pieces)
>{
> sq=bitscan_first_and_reset(pieces);
> File(sq)>2 ? mask=NOT_FILE_AB:mask=NOT_FILE_GH;
> if (sq>C3) attacks=(KNIGHTC3>>(sq-C3)) & mask;
> else attacks|=(KNIGHTC3<<(C3-sq)) & mask;
>}
OOps, this one is incorrect.
Best is to split in File(sq)<2,File(sq)>5 and "else" (mask=ALL)
Tony
>
>For king is the same but on square B2. Since most of the time sq>C3 (or B2)
>branch prediction should be OK.
>
>Tony
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.