Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: attacks_from[] and attacks_to[] info

Author: Sune Fischer

Date: 02:56:25 10/23/02

Go up one level in this thread


On October 22, 2002 at 18:55:09, Gerd Isenberg wrote:

>On October 22, 2002 at 18:52:11, Gerd Isenberg wrote:
>
>>On October 22, 2002 at 18:47:54, Gerd Isenberg wrote:
>>
>>>one possible improvement :-)
>>>
>>>I would guess this reduces dependencies and may shlightly or microscopic faster:
>>>
>>>bitboard WhitePawnAttacks (bitboard b)
>>>{
>>>        bitboard c = b;
>>>        b ^= b;  // b ^= c has to wait for the previous instruction
>>>        b |= (c << 7) & 0x7F7F7F7F7F7F7F7F;
>>>        b |= (c << 9) & 0xFEFEFEFEFEFEFEFE;
>>>        return b;
>>>}
>>>
>>>Gerd
>>
>>Or of course:
>>
>>bitboard WhitePawnAttacks (bitboard b)
>>{
>>        bitboard c = b;
>>        b  = (c << 7) & 0x7F7F7F7F7F7F7F7F;
>>        b |= (c << 9) & 0xFEFEFEFEFEFEFEFE;
>>        return b;
>>}
>
>what about this:
>
>bitboard WhitePawnAttacks (bitboard b)
>{
>        return ((b << 7) & 0x7F7F7F7F7F7F7F7F)
>              |((b << 9) & 0xFEFEFEFEFEFEFEFE);
>}

Isn't that what everyone is doing? ;)

From Crafty:
    pcapturesl=(WhitePawns & mask_left_edge)>>7 & target;

I don't know why Crafty also has a pawn attack table, seems pretty redundant to
me, probably even a slowdown.

-S.



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.