Browse files

Optimize an expression in endgame.cpp

I believe using foward_file_bb() here is fewer instructions.

a) Fewer instructions and probably more clear (debatable).
b) Possible that a lookup is slower than a few local operations, but the
   forward_file_bb table is probably used often enough that it is always

LLR: 2.96 (-2.94,2.94) [-3.00,1.00]
Total: 21004 W: 4263 L: 4141 D: 12600

Closes official-stockfish#1644

No functional change.
  • Loading branch information...
protonspring authored and Stéphane Nicolet committed Jun 11, 2018
1 parent 88de112 commit fc3af7c4fbeaa3c5b85424077829223f9d18184e
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/endgame.cpp
@@ -214,7 +214,7 @@ Value Endgame<KRKP>::operator()(const Position& pos) const {
Value result;
// If the stronger side's king is in front of the pawn, it's a win
if (wksq < psq && file_of(wksq) == file_of(psq))
if (forward_file_bb(WHITE, wksq) & psq)
result = RookValueEg - distance(wksq, psq);
// If the weaker side's king is too far from the pawn and the rook,

0 comments on commit fc3af7c

Please sign in to comment.