Author: Sune Fischer
Date: 14:21:16 12/05/03
Go up one level in this thread
On December 05, 2003 at 17:16:23, Tim Foden wrote:
>On December 05, 2003 at 16:15:51, Sune Fischer wrote:
>
>>On December 05, 2003 at 13:43:05, Russell Reagan wrote:
>>
>>>On December 05, 2003 at 07:20:37, Gerd Isenberg wrote:
>>>
>>>>Was it your intention to mix lsb- with msb-routines?
>>>
>>>For this program they produce the same checksum since all of the bitboards have
>>>a population of one (msb == lsb, in this test).
>>>
>>>It probably doesn't matter for a lot of bitboard chess programs. For most, any
>>>bit will do. For some it matters. I know for some of the filler stuff I've
>>>written I had to make sure I used a lsb or msb. I think both will be
>>>approximately the same speed, or very close.
>>
>>You can optimize some of the routines to take advantage of that.
>>For instance you save the &'s in the TableBitscan16 version:
>>
>>int TableOneBitscan16 (Bitboard b) {
>> if (b<<48)
>> return table16[b];
>> if (b<<32)
>> return table16[b >> 16] + 16;
>> if (b<<16)
>> return table16[b >> 32] + 32;
>> return table16[b >> 48] + 48;
>>}
>>
>>-S.
>
>I don't think this works in the general case Sune. :)
>It will work for single bits, but not if more bits can be set.
It won't work in the general case, it is an optimization that only works when
there is a single bit set (as in Russell's test).
But of course you can make certain of that by adding Bitboard bb=b&-b; to the
start of the function.
It might still be competitive, particularly in view of the fact that you often
need to mask out the found bit anyway.
>Assume b = 0x0102030405060708.
>b << 48 will be non zero, and now you use the whole of b as an index to
>table16... I think the index will be out of bounds!
Yep :)
-S.
>Cheers, Tim.
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.