Author: José Carlos
Date: 06:09:42 02/26/03
Hi all,
there're quite some implementations of FirstOne and LastOne out there, but I
enjoy trying to figure out things myself. I've forgotten most of my assembly
lessons though.
Last night I came up with the following function:
INLINE UINT32 LeftMostOne(UINT64 bb)
{
__asm
{
bsr edx,dword ptr [bb+4] // left side (a8-h5)
jz RightSide
mov eax,31
jmp Substract
RightSide:
bsr edx,dword ptr [bb]
mov eax,63
Substract:
sub eax,edx
}
}
Note that my board representation is MSB(bit 63) = a8; bit 62 = b8; ...; (bit
1) = g1; LSB(bit 0) = h1
The function calculates the letmost (closest to a8) bit.
I'd like to know what inneficient things I'm doing in the above function and
why.
Thanks in advance,
José C.
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.