Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitscan

Author: Matt Taylor

Date: 14:08:34 02/12/03

Go up one level in this thread


On February 12, 2003 at 14:14:58, Gerd Isenberg wrote:

>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

I do, but I was assuming that leaving it in eax is not technically legal for VC.
The VC docs on inline assembly are extremely vague about everything besides
syntax. Alternatively one can use __declspec(naked), but then inlining is
problematic.

I can try this...I am hesitant, though it's probably true that it will always
work.

-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.