Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: FirstOne for Linux

Author: Robert Hyatt

Date: 20:11:21 03/29/03

Go up one level in this thread


On March 29, 2003 at 19:46:54, Sune Fischer wrote:

>On March 29, 2003 at 17:23:58, Robert Hyatt wrote:
>
>>On March 29, 2003 at 09:00:22, Sune Fischer wrote:
>>
>>>I'm trying to compile my program with GCC, and the assembler parts are causing
>>>me some problems.
>>>
>>>I couldn't find any assembler versions of FirstOne and PopCount in Crafty.
>>>Are the table versions in C much slower?
>>
>>Did you look at X86.s?
>>
>>That's where they are.
>
>Yeah, so I was told, but they are not easy to "get into" the program.
>
>I also found that the tables are practicly just as fast, with portability in
>mind that might be a better choice for me.
>
>However, Crafty is using the most significant bit as the first bit, right?
>
>int FirstOne(BITBOARD arg1) {
>    if (arg1>>48)
>      return (first_one[arg1>>48]);
>    if ((arg1>>32)&65535)
>      return (first_one[(arg1>>32)&65535]+16);
>    if ((arg1>>16)&65535)
>      return (first_one[(arg1>>16)&65535]+32);
>    return (first_one[arg1&65535]+48);
>}
>
>You check the upper 16 bits first, so...
>
>Was easy to rewrite though :)
>
>I wonder if the cache friendly 8 bit version is faster?
>
>-S.


MSB=0, LSB=63, correct.

I tried both and they were pretty similar if I recall...







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.