Skip to content

Commit fc3af7c

Browse files
protonspringsnicolet
protonspring
authored andcommitted
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 cached. Passed LLR: 2.96 (-2.94,2.94) [-3.00,1.00] Total: 21004 W: 4263 L: 4141 D: 12600 http://tests.stockfishchess.org/tests/view/5b1cad830ebc5902ab9c6239 Closes #1644 No functional change.
1 parent 88de112 commit fc3af7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/endgame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Value Endgame<KRKP>::operator()(const Position& pos) const {
214214
Value result;
215215

216216
// If the stronger side's king is in front of the pawn, it's a win
217-
if (wksq < psq && file_of(wksq) == file_of(psq))
217+
if (forward_file_bb(WHITE, wksq) & psq)
218218
result = RookValueEg - distance(wksq, psq);
219219

220220
// If the weaker side's king is too far from the pawn and the rook,

0 commit comments

Comments
 (0)