Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Mixing 0x88 and bitboards

Author: Dieter Buerssner

Date: 14:09:42 06/25/02

Go up one level in this thread


On June 25, 2002 at 16:35:26, Gian-Carlo Pascutto wrote:

>if (board[E6] == wpawn)
>
>1 load
>1 compare
>
>if (WhitePawns & Mask[e6])
>
>2 64-bit loads
>1 64-bit and
>1 64-bit compare

Hidden in some macros one could write

  if ((WhitePawns.low32 & Mask[e6].low32)
      | (WhitePawns.high32 & Mask[e6].high32))

4 32 bit loads,
2 32 bit ands
1 32 bit or and branch based on the flags.

An intelligent compiler could produce better code with something like

if (WhitePawns & (1ULL << E6))

1 32-bit load,
1 32-bit and, branch based on the flags.

Of course, this optimization cannot work anymore, when E6 is "sq".

Regards,
Dieter




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.