Author: Dieter Buerssner
Date: 07:52:02 02/06/03
Go up one level in this thread
On February 06, 2003 at 06:30:17, David Rasmussen wrote:
>INLINE int PopCount(BitBoard a)
__inline__ int PopCount(BITBOARD a)
{
int tmp, tmp2, n;
__asm__ __volatile__(
"movl %3, %1
xorl %0, %0
testl %1, %1
je 1f
0: incl %0
leal -1(%1), %2
andl %2, %1
jne 0b
1: movl %4, %1
testl %1, %1
je 3f
2: incl %0
leal -1(%1), %2
andl %2, %1
jne 2b
3:"
: "=r&" (n), "=r&" (tmp), "=r&" (tmp2)
: "g" (*(unsigned long *)&a)), "g" (*(((unsigned long *)&a)+1))
: "cc" /* Flags "condition code" changed */);
return n;
}
I gave some more comments and a C-version with the same algorithm, that
shouldn't be slower in http://f11.parsimony.net/forum16635/messages/31324.htm
Regards,
Dieter
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.