Author: Dieter Buerssner
Date: 13:08:50 09/25/02
Go up one level in this thread
On September 24, 2002 at 20:32:19, Dann Corbit wrote:
>On September 24, 2002 at 19:10:18, Arshad Syed wrote:
>
>>I am planning to write my own engine soon. Preferably I would like to code the
>>search engine in Assembly Language since nodes/sec is a very important factor
>>for me. Is it easy to interface Winboard with Assembly language code?
>
>Sure. Put C wrappers around everything.
>
>For instance, from Crafty's vcinline.h:
>
>#if _MSC_VER >= 1200
>#define FORCEINLINE __forceinline
>#else
>#define FORCEINLINE __inline
>#endif
>
>FORCEINLINE int PopCnt(BITBOARD a) {
>/* Because Crafty bitboards are typically sparsely populated, we use a
> streamlined version of the boolean.c algorithm instead of the one in x86.s
>
> __asm {
> mov ecx, dword ptr a
> xor eax, eax
> test ecx, ecx
> jz l1
> l0: lea edx, [ecx-1]
> inc eax
> and ecx, edx
> jnz l0
> l1: mov ecx, dword ptr a+4
> test ecx, ecx
> jz l3
> l2: lea edx, [ecx-1]
> inc eax
> and ecx, edx
> jnz l2
> l3:
> }
>}
Perhaps an example, where one can use as efficiently high level language. See my
comment some time ago at http://f11.parsimony.net/forum16635/messages/31324.htm
The C code (slighly microtuned for a 32 bit architecture by using 2 loops for
the 2 32 bit parts of the bitboard - as the assembly above does as well)
produces essentially the same assembly. I did not profile it, but there might
even be a chance, that it is faster, because of the missing alignment of the
jump destinations.
Regards,
Dieter
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.