Author: Marcus Heidkamp
Date: 01:03:38 06/15/01
Go up one level in this thread
On June 14, 2001 at 19:34:09, Dann Corbit wrote: >Using this "darn-fast" branchless first-bit location routine: >int FirstPiece(BITBOARD bits) >{ >// if (bits == 0) return -1; >__asm { >; 64-bit number to move into ECX:EBX, will never be zero! > mov ecx,dword ptr [bits+4] > mov ebx,dword ptr [bits] > bsf eax,ecx > add eax,32 > bsf eax,ebx > } >} > >I would think that iterating over the board would be just as fast (or possibly >faster) than using piece lists. > >I am curious if others who use bitboards find piece lists to be valuable. >I am somewhat surprised to see that FirstPiece() is consuming a lot of CPU. Hi Dann! Are you sure this works? According to Intel's specs the destination of bsf will be UNDEFINED if the source is zero. It may be overwritten by the last bsf if ebx is zero. I do not have my FirstPiece() function at hand, but I needed to use a conditional move for exactly that case. As far as I recall you are using an AMD processor. That might be the reason why it works. Marcus
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.