Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 64Bit optimize coding - My experience (AMD64)

Author: Tord Romstad

Date: 13:57:40 12/22/05

Go up one level in this thread


On December 22, 2005 at 13:13:53, Gerd Isenberg wrote:

>On December 22, 2005 at 11:42:43, Tord Romstad wrote:
>
>>I use the following one in Glaurung:
>>
>>const uint32 BitTable[64] = {
>>  0,1,2,7,3,21,16,35,4,49,22,52,17,66,36,80,5,33,50,70,23,86,53,96,18,55,67,
>>  102,37,98,81,113,119,6,20,34,48,51,65,71,32,69,85,87,54,101,97,112,118,19,
>>  39,64,68,84,100,103,117,38,83,99,116,82,115,114
>>};
>>
>>inline uint32 first_1(bitboard_t b) {
>>  return BitTable[((b&-b)*0x218a392cd3d5dbfULL)>>58];
>>}
>>
>>The last time I checked, it was faster than the other non-assembly language
>>alternatives on my G5.  The code was posted by Gerd, I think.
>
>Yes, posted a lot of times, but not with that strange indizes ;-)

Yes, I forgot to mention that I use a 16-file board.

Interesting list of links snipped -- I'll try to have a look at them
later.  Thanks!

>0x218a392cd3d5dbfULL is reserverd for you, Tord ;-)

You keep a central register with all the numbers which are used?
Cool!  :-)

In fact, even though I came up with the number 0x218a392cd3d5dbfULL
on my own, I am fairly sure it is quite frequently used, and that
many programmers have found it independently.  I used a very
natural and straightforward algorithm to compute the number, with
no random choice anywhere.  I just started with the number 1 and
let my program churn out the rest in a completely deterministic
way.

I no longer remember the exact algorithm I used (and I can't find
the code), but it was so obvious that it would surprise me if
nobody else have done exactly the same and ended up with the
same number.

Tord



This page took 0.01 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.