Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Assembly Programmers Challenge! (repost and clarification)

Author: Matt Taylor

Date: 23:50:45 01/21/03

Go up one level in this thread


On January 21, 2003 at 19:18:34, Sean Mintz wrote:

>>INLINE int FirstBit(const BitBoard bitboard)
>>{
>>	__asm
>>	{
>>		bsf		eax,[bitboard+4]
>>		xor		eax, 32
>>		bsf		eax,[bitboard]
>>	}
>>}
>>
>>INLINE int LastBit(const BitBoard bitboard)
>>{
>>	__asm
>>	{
>>		bsr eax,[bitboard]
>>		sub eax,32
>>		bsr eax,[bitboard+4]
>>		add eax,32
>>	}
>>}
>
>I tried using these in crafty and crafty froze up or something. Any ideas why?

Not all bitboards are equal.

Crafty orders its bitboards backward in a sense. For Crafty, 0x8000000000000000
has bit 0 set, and 0x0000000000000001 has bit 63 set. Also,
LastBit(0x0000000000000000) should return 64 for Crafty.

These routines first assume that the parameter can never be 0 (so at least 1 bit
is set. Second, the bit ordering is the opposite of Crafty's bit ordering --
0x0000000000000001 is bit 0 and 0x8000000000000000 is bit 63.

-Matt



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.