From c109a88ebe93ab7652c7cb4694cfc405568e5e50 Mon Sep 17 00:00:00 2001 From: Timothy Herchen Date: Tue, 2 Dec 2025 15:50:24 -0800 Subject: [PATCH] fix missing condition Fixes a bug in https://github.com/official-stockfish/Stockfish/pull/6453 https://github.com/official-stockfish/Stockfish/commit/abd835dcbc3a28481224f6253b00b7420d062513 The modifications to the DirtyThreats bitboards should only happen if PutPiece is true. This somehow didn't affect bench at the default parameters. Reference AVX2: ./stockfish.killdeer-fix.avx2 bench 64 1 23 Nodes searched : 178140156 Nodes/second : 1503152 before patch: ./stockfish.master.avx512icl bench 64 1 23 Nodes searched : 218349728 Nodes/second : 1743450 after patch: ./stockfish.killdeer-fix.avx512icl bench 64 1 23 Nodes searched : 178140156 Nodes/second : 1727520 passed STC: LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 39328 W: 10293 L: 10080 D: 18955 Ptnml(0-2): 113, 4306, 10629, 4487, 129 https://tests.stockfishchess.org/tests/view/692fb2d8b23dfeae38d01c81 closes https://github.com/official-stockfish/Stockfish/pull/6463 Bench: 2912398 --- src/position.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 049c72682..b08cabf3f 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -1159,8 +1159,11 @@ void Position::update_piece_threats(Piece pc, if (!all_attackers) return; // Square s is threatened iff there's at least one attacker - dts->threatenedSqs |= square_bb(s); - dts->threateningSqs |= all_attackers; + if constexpr (PutPiece) + { + dts->threatenedSqs |= square_bb(s); + dts->threateningSqs |= all_attackers; + } DirtyThreat dt_template{NO_PIECE, pc, Square(0), s, PutPiece}; write_multiple_dirties(*this, all_attackers,