Computer Chess Club Archives


Search

Terms

Messages

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

Author: Gerd Isenberg

Date: 15:52:11 10/22/02

Go up one level in this thread


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;
}



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.