Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Extracting information from rotated Bitboards

Author: Robert Hyatt

Date: 10:05:57 11/03/98

Go up one level in this thread


On November 03, 1998 at 09:44:36, John Stoneham wrote:

>On November 02, 1998 at 21:45:05, Robert Hyatt wrote:
>
>>a couple of tricks...
>>
>>1.  you can use square&56 as the shift amount for the 90 degree rotated bit map,
>>since that will get you exactly the right shift count for any rank...
>>
>>2.  you may use a bishop shift value, but you can get away by always using 8
>>bits from the rotated diagonal bitmaps, if you simply set up the array so that
>>the "unused bits" still produce the right answer.  This avoids having a
>>different mask for each diagonal length...
>
>The reason I pre-calculate even the simple shift and mask amounts, is that I
>believe an operation such as ((bitboard & mask[sq]) >> shift[sq]) is probably
>faster than, for example, ((bitboard >> (sq & 56)) & 0x00ff). I may be wrong,
>and I should probably set up a simple test program to see what the actual
>differnce is.

It should be much slower.  mask[sq] has *two* memory referencess.  sq&56 has
one.  If you do that a lot, it might not matter as you should get a L1 cache
hit (or at least a L2 hit).  However, if you look at the above, on a non-alpha
it gets even worse, because bitboard & mask is a 64 bit and operation.  the
bitboard>>is a 64 bit shift only...  so on a 32 bit architecture the sq&56
ought to be signficantly faster...

on the PC's you count memory references *not* instructions.  Because the typical
memory delay is 20+ clock cycles...



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.