Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: LSB and POPCOUNT optimization

Author: Tim Foden

Date: 01:48:03 06/20/02

Go up one level in this thread


On June 18, 2002 at 13:14:28, Gerd Isenberg wrote:

>On June 18, 2002 at 12:15:09, Adriano Bedeschi de Souza wrote:
>
>>Could someone help me with LSB (MSB) and POPCOUNT optimization?
>>
>>thx,
>>Bedeschi
>
>some sample source code for msc6 with sone inline asm:
>
>LSB with reset found bit:
>
>// precondition: bb not null
>__forceinline unsigned int BitSearchAndReset(BitBoard &bb)
>{
>#ifdef	_M_IX86
>	__asm
>	{
>		mov		edx, [bb]
>		bsf		eax, [edx+4]
>		xor		eax, 32
>		bsf		eax, [edx]
>		btr		[edx],eax
>	}

I'm afriad the above code won't work as intended, as the "btr [edx], eax" line
will always affect the low 32 bits and never the high 32 bits.

Cheers, Tim.



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.