Author: Gert-Jan Hovinga
Date: 12:48:16 01/10/03
Go up one level in this thread
Hi Uri,
this should work for you:
inline int PopCount(const BitBoard bitBoard)
{
__asm
{
mov ecx, dword ptr [bitBoard]
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 [bitBoard + 4]
test ecx, ecx
jz l3
l2:
lea edx, [ecx - 1]
inc eax
and ecx, edx
jnz l2
l3:
}
}
remove the 'const' if you're not using C++
--gert-jan
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.