Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Begging for assembler FirstOne() and LastOne()

Author: Matthias Gemuh

Date: 12:48:52 05/18/02

Go up one level in this thread


On May 18, 2002 at 13:52:57, Andrew Dados wrote:

>On May 18, 2002 at 13:38:02, Matthias Gemuh wrote:
>
>>
>>Hi Experts,
>>I want to speed up my chess engine and need assembler versions of these
>>functions. These below seem to be pentium-specific. I need something general
>>and don't understand assembler.
>>
>>int FirstBit(BITBOARD a)
>>{
>>  __asm {
>>        bsr     edx, dword ptr a+4
>>        mov     eax, 31
>>        jnz     l6
>>        bsr     edx, dword ptr a
>>        mov     eax, 63
>>        jnz     l6
>>        mov     edx, -1
>>  l6:   sub     eax, edx
>>  }
>>}
>>
>>int LastBit(BITBOARD a)
>>{
>>  __asm {
>>        bsf     edx, dword ptr a
>>        mov     eax, 63
>>        jnz     l7
>>        bsf     edx, dword ptr a+4
>>        mov     eax, 31
>>        jnz     l7
>>        mov     edx, -33
>>  l7:   sub     eax, edx
>>  }
>>}
>>
>>Please, help me.
>>
>>Thanks,
>>Matthias.
>
>Those functions will work on all i386 - compatible processors. They are as
>general as assembler can get.
>
>-Andrew-


Unfortunately, they even crash on my Athlon 1.4, compiled with BCB 5.0.

Matthias.







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.