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
This commit is contained in:
Arseniy Surkov
2025-08-30 15:17:57 +02:00
committed by Joost VandeVondele
parent 7a3483fa9e
commit 731ad9bbc3
2 changed files with 4 additions and 5 deletions
+1
View File
@@ -32,6 +32,7 @@ Antoine Champion (antoinechampion)
Aram Tumanian (atumanian) Aram Tumanian (atumanian)
Arjun Temurnikar Arjun Temurnikar
Aron Petkovski (fury) Aron Petkovski (fury)
Arseniy Surkov (codedeliveryservice)
Artem Solopiy (EntityFX) Artem Solopiy (EntityFX)
Auguste Pop Auguste Pop
Balazs Szilagyi Balazs Szilagyi
+3 -5
View File
@@ -183,8 +183,7 @@ class Position {
Square& rfrom, Square& rfrom,
Square& rto, Square& rto,
DirtyPiece* const dp = nullptr); DirtyPiece* const dp = nullptr);
template<bool AfterMove> Key adjust_key50(Key k) const;
Key adjust_key50(Key k) const;
// Data members // Data members
Piece board[SQUARE_NB]; 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 Bitboard Position::check_squares(PieceType pt) const { return st->checkSquares[pt]; }
inline Key Position::key() const { return adjust_key50<false>(st->key); } inline Key Position::key() const { return adjust_key50(st->key); }
template<bool AfterMove>
inline Key Position::adjust_key50(Key k) const { 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; } inline Key Position::pawn_key() const { return st->pawnKey; }