Author: Vincent Diepeveen
Date: 19:31:04 09/15/01
Go up one level in this thread
On September 15, 2001 at 20:34:36, Robert Hyatt wrote:
>On September 15, 2001 at 14:30:40, Vincent Diepeveen wrote:
[snip]
>FirstOne() isn't particularly slow, using the bit-scan instructions that
>are very fast on PII and beyond. It certainly isn't much of a cost in the
>profile runs I do.
FORCEINLINE int FirstOne(BITBOARD a) {
#if _M_IX86 <= 500 /* on plain Pentiums, use boolean.c algorithm */
__asm {
movzx edx, word ptr a+6
xor eax, eax
test edx, edx
jnz l1
mov dx, word ptr a+4
mov eax, 16
test edx, edx
jnz l1
mov dx, word ptr a+2
mov eax, 32
test edx, edx
jnz l1
mov dx, word ptr a
mov eax, 48
l1: add al, byte ptr first_ones[edx]
}
#else /* BSF and BSR are *fast* instructions on PPro/PII */
__asm {
bsr edx, dword ptr a+4
mov eax, 31
jnz l1
bsr edx, dword ptr a
mov eax, 63
jnz l1
mov edx, -1
l1: sub eax, edx
}
#endif /* _M_IX86 > 500 */
}
Ugh ugh, how slow is 'particularly slow' slow in your dictionary?
Best regards,
Vincent
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.