Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about speed and bitboard

Author: E. Nielsen

Date: 04:13:15 09/20/04

Go up one level in this thread


On September 19, 2004 at 10:38:03, Robert Hyatt wrote:

>On September 18, 2004 at 17:12:23, E. Nielsen wrote:
>
>>On September 16, 2004 at 21:20:50, Uri Blass wrote:
>>
>>>...doing a loop on the 1's of a bitboard...
>>
>>Well, I suppose it depends on which representation you choose for your
>>bitboard...
>>
>>If it is in two's-complement form (i.e. signed) you can find the rightmost 1-bit
>>with following formula:
>>
>>                           x & (-x)
>>
>
>
>Finding the bit is not quite the same as finding the identity or number of the
>bit.  IE findihg bit for square e4 is easy.  But if you want to know if it is
>the e4 square, id bit # X, then that is harder.  Fortunately modern processors
>can do this easily...
>

True, I was a bit hasty there... Isn't encapsulation great? Of course there was
more to it - actually I've had forgotten to get back to some code where I use
the number of leading zeros as index, which can be done as a binary search...


>
>
>
>>
>>Regards,
>>EyĆ°un Nielsen
>>
>>P.s.: And I would also recommend the book "Hacker's Delight" by Henry S. Warren,
>>Jr. which is full of stuff like this. :)



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.