mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-22 01:56:58 +08:00
Remove redundant king square parameter
We don't need to pass the king square as an explicit parameter to the functions king_safety() and do_king_safety() since we already pass in the position. STC: LLR: 2.95 (-2.94,2.94) [-3.00,1.00] Total: 69686 W: 14894 L: 14866 D: 39926 http://tests.stockfishchess.org/tests/view/5be84ac20ebc595e0ae3283c No functional change.
This commit is contained in:
committed by
Stéphane Nicolet
parent
30a905c95d
commit
68209c9121
@@ -415,7 +415,7 @@ namespace {
|
|||||||
Bitboard kingFlank, weak, b, b1, b2, safe, unsafeChecks;
|
Bitboard kingFlank, weak, b, b1, b2, safe, unsafeChecks;
|
||||||
|
|
||||||
// King shelter and enemy pawns storm
|
// King shelter and enemy pawns storm
|
||||||
Score score = pe->king_safety<Us>(pos, ksq);
|
Score score = pe->king_safety<Us>(pos);
|
||||||
|
|
||||||
// Find the squares that opponent attacks in our king flank, and the squares
|
// Find the squares that opponent attacks in our king flank, and the squares
|
||||||
// which are attacked twice in that flank but not defended by our pawns.
|
// which are attacked twice in that flank but not defended by our pawns.
|
||||||
|
|||||||
@@ -237,8 +237,9 @@ Value Entry::evaluate_shelter(const Position& pos, Square ksq) {
|
|||||||
/// when king square changes, which is about 20% of total king_safety() calls.
|
/// when king square changes, which is about 20% of total king_safety() calls.
|
||||||
|
|
||||||
template<Color Us>
|
template<Color Us>
|
||||||
Score Entry::do_king_safety(const Position& pos, Square ksq) {
|
Score Entry::do_king_safety(const Position& pos) {
|
||||||
|
|
||||||
|
Square ksq = pos.square<KING>(Us);
|
||||||
kingSquares[Us] = ksq;
|
kingSquares[Us] = ksq;
|
||||||
castlingRights[Us] = pos.can_castle(Us);
|
castlingRights[Us] = pos.can_castle(Us);
|
||||||
int minKingPawnDistance = 0;
|
int minKingPawnDistance = 0;
|
||||||
@@ -260,7 +261,7 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Explicit template instantiation
|
// Explicit template instantiation
|
||||||
template Score Entry::do_king_safety<WHITE>(const Position& pos, Square ksq);
|
template Score Entry::do_king_safety<WHITE>(const Position& pos);
|
||||||
template Score Entry::do_king_safety<BLACK>(const Position& pos, Square ksq);
|
template Score Entry::do_king_safety<BLACK>(const Position& pos);
|
||||||
|
|
||||||
} // namespace Pawns
|
} // namespace Pawns
|
||||||
|
|||||||
@@ -50,13 +50,13 @@ struct Entry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<Color Us>
|
template<Color Us>
|
||||||
Score king_safety(const Position& pos, Square ksq) {
|
Score king_safety(const Position& pos) {
|
||||||
return kingSquares[Us] == ksq && castlingRights[Us] == pos.can_castle(Us)
|
return kingSquares[Us] == pos.square<KING>(Us) && castlingRights[Us] == pos.can_castle(Us)
|
||||||
? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos, ksq));
|
? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Color Us>
|
template<Color Us>
|
||||||
Score do_king_safety(const Position& pos, Square ksq);
|
Score do_king_safety(const Position& pos);
|
||||||
|
|
||||||
template<Color Us>
|
template<Color Us>
|
||||||
Value evaluate_shelter(const Position& pos, Square ksq);
|
Value evaluate_shelter(const Position& pos, Square ksq);
|
||||||
|
|||||||
Reference in New Issue
Block a user