Author: David Rasmussen
Date: 06:00:37 01/15/02
Go up one level in this thread
On January 15, 2002 at 08:49:16, Severi Salminen wrote: > >But then again, why not use the allready equally fast FirstBit()... > >Severi I have both a LastBit and a FirstBit for several reasons. First of all, if I know there is a white passer on a file (because I store that in my pawn hash table), but I don't know what square it is on, I can do LastBit(pos.bitboard[WHITE][PAWN] & FileMask(file)). This can't be done with FirstBit(). FirstBit() will be used equivalently for black passers, though. Secondly, since I don't know what architechture I am on, I don't know whether my FirstBit() takes constant time, or if it depends on the number of leading zeros. It does if it uses the portable C version instead of the assembler version. Whether the assembler version is constant time, I don't know (and you don't either judging from your questions elsewhere in the thread :). And if it _does_ depend on the number of leading zeros, it will on average be quicked to to lastbit to black pieces, since they are more often than not in the upper half of the board. I don't want my design to rely on the properties of one processor. So I use LastBit() when I expect the bit more often than not to be in the upper half. If indeed FirstBit() and LastBit() are constant time functions, then it doesn't matter anyway. /David
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.