Author: Sune Fischer
Date: 06:50:33 09/22/03
Go up one level in this thread
On September 22, 2003 at 09:10:55, Vincent Diepeveen wrote: > >And 2.2 times slower even with inline assembly. > >Not to mention what happens when you don't have assembly available. > >For everyone who does *not* like to have inline assembly, do *not* use >bitboards. Actually, I just tested a simple C version against the assembler version yesterday, and the C version came out faster on my "frenzee mark". with assembler : 1072 no assembler : 1092 (!) Quite a big difference so I was somewhat surprized. The C version is "cheating" by using a big table though, could be bad in the long run if the program grows. The C version: inline FirstOneClear(BitBoard &bb) { // preconditioned by bb!=0 BitBoard b = bb & -bb; bb ^= b; if (b<<48) return (first_one[b]); if (b<<32) return (first_one[b>>16]+16); if (b<<16) return (first_one[b>>32]+32); return (first_one[b>>48]+48); } The Assembler version: inline FirstOneClear(BitBoard &bb) { __asm { xor edx, edx mov ebx, [bb] xor eax, eax inc edx bsf ecx, [ebx] jnz found bsf ecx, [ebx+4] lea ebx, [ebx+4] xor eax, 32 found: shl edx, cl xor eax, ecx xor [ebx], edx } } the assembler returns 63-square, so it must be flipped. Maybe faster versions of both even exists :) -S.
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.