Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: fast bit counting

Author: Ernst A. Heinz

Date: 08:02:52 04/19/00

Go up one level in this thread


Hi Flemming,

>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:
>
>1) The position of the first and/or last bit in a sequence of 64 bits.
>2) Count the number of bits that are 1 in a sequence of 64 bits.
>
>I know there is a method that works linear in the number of on-bits for
>problem 2:
>
>    for(count = 0; bitboard; count++, bitboard &= (bitboard -1));
>
>
>Is there anything faster, ie. such lookuptables or machine code intrutions?
>
>What about problem 1?
>
>Thanks in advance for any reply

My article about "How DarkThought Plays Chess" in the ICCA
Journal 20(3), pp. 166-176, Sept. 1997 contains some valuable
information about your subject of interest.

Please have a look at the WWW pages of "DarkThought" at URL
http://supertech.lcs.mit.edu/~heinz/dt/ in order to find an
electronic preprint of this article among others.

=Ernst=




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.