diff --git a/src/search.cpp b/src/search.cpp index 161767d7c..cc6143dd5 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -115,14 +115,13 @@ void update_correction_history(const Position& pos, shared.nonpawn_correction_entry(pos).at(us).nonPawnWhite << bonus * nonPawnWeight / 128; shared.nonpawn_correction_entry(pos).at(us).nonPawnBlack << bonus * nonPawnWeight / 128; - // Branchless: use mask to zero bonus when move is not ok - const int mask = int(m.is_ok()); - const Square to = m.to_sq_unchecked(); - const Piece pc = pos.piece_on(to); - const int bonus2 = (bonus * 126 / 128) * mask; - const int bonus4 = (bonus * 63 / 128) * mask; - (*(ss - 2)->continuationCorrectionHistory)[pc][to] << bonus2; - (*(ss - 4)->continuationCorrectionHistory)[pc][to] << bonus4; + if (m.is_ok()) + { + const Square to = m.to_sq(); + const Piece pc = pos.piece_on(to); + (*(ss - 2)->continuationCorrectionHistory)[pc][to] << bonus * 126 / 128; + (*(ss - 4)->continuationCorrectionHistory)[pc][to] << bonus * 63 / 128; + } } // Add a small random component to draw evaluations to avoid 3-fold blindness