Author: Sergei S. Markoff
Date: 10:05:14 06/12/04
Hello All!
In SmarThink 0.17a I had such implenetation on this functions:
#define LastOne(arg1) ((WORD)(arg1)) ? (last_ones[(WORD)(arg1)]) : (((WORD)
((arg1)>>16) ) ? (last_ones[(WORD)((arg1)>>16)]+16) : (( (WORD) ((arg1)>>32) ) ?
(last_ones[(WORD)((arg1)>>32)]+32) : (last_ones[((arg1)>>48)]+48)))
#define FirstOne(arg1) (((arg1)>>48)) ? (first_ones[((arg1)>>48)]+48) :
(((WORD) ((arg1)>>32) ) ? (first_ones[(WORD)((arg1)>>32)]+32) : (( (WORD)
((arg1)>>16) ) ? (first_ones[(WORD)((arg1)>>16)]+16) :
(first_ones[(WORD)(arg1)])))
But the problem is that the large arrays causes more cash fails which makes
engine slower.
Now I tried other method, using bsf/bsr instructions:
__inline int FirstOne(BITBOARD a)
{
__asm {
bsr eax, dword ptr a+4
jnz l1
bsr eax, dword ptr a
jmp l2
l1: add eax, 32
l2:
}
}
__inline int LastOne(BITBOARD a)
{
__asm {
bsf eax, dword ptr a
jnz l1
bsf eax, dword ptr a+4
add eax, 32
l1:
}
}
But the result isn't impressive. This works slower than previous version. I have
Athlon-1700XP+ and Intel C/C++ v6 compiler (v7 produces slower code).
What was wrong?
Sergei
This page took 0.01 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.