From 731ad9bbc3332cb7c73ef9aa8797e38c9deee452 Mon Sep 17 00:00:00 2001 From: Arseniy Surkov <93079612+codedeliveryservice@users.noreply.github.com> Date: Fri, 29 Aug 2025 04:12:23 +0300 Subject: [PATCH] Simplify `adjust_key50` template Remove the AfterMove template from the adjust_key50 function, which is only ever called with false. closes https://github.com/official-stockfish/Stockfish/pull/6278 No functional change --- AUTHORS | 1 + src/position.h | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index 804824d8c..6bd323d2c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -32,6 +32,7 @@ Antoine Champion (antoinechampion) Aram Tumanian (atumanian) Arjun Temurnikar Aron Petkovski (fury) +Arseniy Surkov (codedeliveryservice) Artem Solopiy (EntityFX) Auguste Pop Balazs Szilagyi diff --git a/src/position.h b/src/position.h index 56bb7b5a4..dde496fe0 100644 --- a/src/position.h +++ b/src/position.h @@ -183,8 +183,7 @@ class Position { Square& rfrom, Square& rto, DirtyPiece* const dp = nullptr); - template - Key adjust_key50(Key k) const; + Key adjust_key50(Key k) const; // Data members Piece board[SQUARE_NB]; @@ -283,11 +282,10 @@ inline Bitboard Position::pinners(Color c) const { return st->pinners[c]; } inline Bitboard Position::check_squares(PieceType pt) const { return st->checkSquares[pt]; } -inline Key Position::key() const { return adjust_key50(st->key); } +inline Key Position::key() const { return adjust_key50(st->key); } -template inline Key Position::adjust_key50(Key k) const { - return st->rule50 < 14 - AfterMove ? k : k ^ make_key((st->rule50 - (14 - AfterMove)) / 8); + return st->rule50 < 14 ? k : k ^ make_key((st->rule50 - 14) / 8); } inline Key Position::pawn_key() const { return st->pawnKey; }