Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bob & Eugene: PopCnt64()

Author: Robert Hyatt

Date: 12:49:07 04/25/01

Go up one level in this thread


On April 25, 2001 at 14:31:27, Bas Hamstra wrote:

>inline int PopCnt(BB M)
>{   unsigned char *p = (unsigned char*) &M;
>    return PopCnt8[p[0]]+PopCnt8[p[1]]+PopCnt8[p[2]]+PopCnt8[p[3]]
>           +PopCnt8[p[4]]+PopCnt8[p[5]]+PopCnt8[p[6]]+PopCnt8[p[7]];
>}
>
>Last time I tested, on my Celeron the above PopCnt was way faster than Crafty's
>asm version. Am I overlooking something? Maybe because my compiler refuses to
>inline asm statements?
>
>
>Bas.


The main point in Crafty is that most of the time only a couple of bits
are set.  In the mobility code I have pre-computed popcnt's so I don't need
to do the PopCnt() call at all.  Almost all calls to this are in Evaluate()
and are used in the pawn structure analysis which means I will be counting
0, 1 or 2 bits max.

Amazingly the loop is far faster there...



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.