Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Binary question

Author: Larry Griffiths

Date: 06:45:35 10/20/00

Go up one level in this thread


On October 20, 2000 at 05:10:33, Severi Salminen wrote:

>
>>>How do I find n in a binary number 2^n? So f(1000b)=3? Now I just shift right:
>
>>Easiest answer is look at the crafty source.  Intel has instructions
>>BSF/BSR to do this.  Or you can do a table lookup.  Code for both
>>approaches is included in Crafty.
>
>How fast are BSF and BSR? I know that pure shifting is very fast, but how many
>shifts do I have to do to be slower than BSR or BSF?
>
>Severi

I estimate that BSF or BSR executes in 1 clock cycle on my Pentium III machine.
I have code that produces square numbers from my 64-bit bitboards.
I could do about 90-120 million extracts a second with this code which consisted
of scanning for the bit, storing the square number, reseting the bit, and
looping looking for the next bit.

Larry.



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.