Author: Omid David Tabibi
Date: 03:34:30 02/03/04
Go up one level in this thread
I tested the following two codes:
////////////////////////////////////////////////////
unsigned char lsbit[256];
void init_bitscan() {
int i, j;
for (i = 0; i < 256; i++) {
for (j = 0; j < 8; j++) {
if (i & (1 << j)) {
lsbit[i] = j;
break;
}
}
}
}
__forceinline int findFirstBitTrue(UINT32 data) {
int result = 0;
if (!(data & 0xffff)) {
data >>= 16;
result += 16;
}
if (!(data & 0xff)) {
data >>= 8;
result += 8;
}
return result + lsbit[data & 0xff];
}
////////////////////////////////////////////////////
__forceinline int findFirstBitTrue(UINT32 data) {
__asm bsf eax, dword ptr[data]
};
////////////////////////////////////////////////////
I ran the benchmark on Falcon using these two implementations. The C version
slowed down the engine by a little over 2%. Not as bad as I expected...
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.