Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitscan

Author: Gerd Isenberg

Date: 11:14:58 02/12/03

Go up one level in this thread


Hi Matt,

thanks for sharing.
Tried it on the fly, forced inlined ~140times in IsiChess.

Stil the fastest for me on my AthlonXP2.0:
(more than 3% faster as the LSB_32_table lookup with some tactical
testpositions):

#pragma warning(disable:4035) // no return value

__forceinline
UINT BitSearchAndReset(BitBoard &bb)
{
	__asm
	{
		xor		edx, edx
		mov		ebx, [bb]
		xor		eax, eax
		inc		edx
		bsf		ecx, [ebx]
		jnz		found
		bsf		ecx, [ebx + 4]
		lea		ebx, [ebx + 4]
		xor		eax, 32
	found:
		shl		edx, cl
		xor		eax, ecx
		xor		[ebx], edx
	}
}

You have some explicite loads and stores:
Why not leaving the return value directly in eax?

Cheers,
Gerd






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.