Author: Zach Wegner
Date: 15:33:25 12/22/05
Go up one level in this thread
On December 22, 2005 at 17:49:41, Gerd Isenberg wrote:
>
>but also a bit redundant expression
>
> l = h | (l & m-1);
>
>is good enough.
Indeed. With that change, as well as reducing my extra shifts for 0x88 to just
one, the two methods are equally as fast at perft. It should be the fastest in a
full-blown program. Your post got me thinking, if I could reduce branches in
other places. Take for example, I have a conditional to get the MSB or LSB based
on a direction (it is used to find the closest piece to a slider):
if (dir <= DIR_RT) // i.e. in the positive direction
to = first_square(moves); //equivalent to LSB
else
to = last_square(moves); // MSB
I found that I could change this to:
to = last_square(moves ^ (moves - 1) * (dir <= DIR_RT));
but it results in a net slowdown! Oh well...
Happy bit-twiddling,
Zach
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.