From 2a1ab11ab019ce588f4f4f4b175ddd6e60d1df36 Mon Sep 17 00:00:00 2001 From: Guenther Demetz Date: Fri, 31 Jan 2025 15:41:03 +0100 Subject: [PATCH] Micro-optimization for SEE: remove a superfluous condition This condition can never be true, it's superfluous. It never triggers even with a bench 16 1 20 run. To met the condition it would imply that the previous recapture was done by a higher rated piece than a Queen. This is only the case when the King recaptures and that's already handled in line 1161: (return (attackers & ~pieces(stm)) ? res ^ 1). closes https://github.com/official-stockfish/Stockfish/pull/5839 No functional change --- src/position.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 439d4ae9..37871aa2 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1137,8 +1137,9 @@ bool Position::see_ge(Move m, int threshold) const { else if ((bb = stmAttackers & pieces(QUEEN))) { - if ((swap = QueenValue - swap) < res) - break; + swap = QueenValue - swap; + // implies that the previous recapture was done by a higher rated piece than a Queen (King is excluded) + assert(swap >= res); occupied ^= least_significant_square_bb(bb); attackers |= (attacks_bb(to, occupied) & pieces(BISHOP, QUEEN))