mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00: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:
parent
30a905c95d
commit
68209c9121
3 changed files with 9 additions and 8 deletions
|
@ -415,7 +415,7 @@ namespace {
|
|||
Bitboard kingFlank, weak, b, b1, b2, safe, unsafeChecks;
|
||||
|
||||
// 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
|
||||
// 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.
|
||||
|
||||
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;
|
||||
castlingRights[Us] = pos.can_castle(Us);
|
||||
int minKingPawnDistance = 0;
|
||||
|
@ -260,7 +261,7 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) {
|
|||
}
|
||||
|
||||
// Explicit template instantiation
|
||||
template Score Entry::do_king_safety<WHITE>(const Position& pos, Square ksq);
|
||||
template Score Entry::do_king_safety<BLACK>(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);
|
||||
|
||||
} // namespace Pawns
|
||||
|
|
|
@ -50,13 +50,13 @@ struct Entry {
|
|||
}
|
||||
|
||||
template<Color Us>
|
||||
Score king_safety(const Position& pos, Square ksq) {
|
||||
return kingSquares[Us] == ksq && castlingRights[Us] == pos.can_castle(Us)
|
||||
? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos, ksq));
|
||||
Score king_safety(const Position& pos) {
|
||||
return kingSquares[Us] == pos.square<KING>(Us) && castlingRights[Us] == pos.can_castle(Us)
|
||||
? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos));
|
||||
}
|
||||
|
||||
template<Color Us>
|
||||
Score do_king_safety(const Position& pos, Square ksq);
|
||||
Score do_king_safety(const Position& pos);
|
||||
|
||||
template<Color Us>
|
||||
Value evaluate_shelter(const Position& pos, Square ksq);
|
||||
|
|
Loading…
Add table
Reference in a new issue