Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: fast bit counting

Author: Jeremiah Penery

Date: 02:41:00 04/19/00

Go up one level in this thread


On April 18, 2000 at 22:44:25, Flemming Rodler wrote:

>Hi,
>
>I am trying to implement a bitboard based chess program on a Pentium or AMD
>computer. I need to be able to find the following information fast:

>2) Count the number of bits that are 1 in a sequence of 64 bits.

On some architectures (Alpha, for example), PopCnt is a hardware instruction.
It will count the 1 bits in an int (or whatever).
On a P6 (PII/PIII/Celeron), I think you could make use of the BSF/BSR
instructions to do this counting.  It might end up being really slow anyway, and
may be difficult to implement.  But I'm not going to worry about that part. :)

Jeremiah



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.