From d27298d7dc0a6222ce21b5ff3b9f16fe72c108af Mon Sep 17 00:00:00 2001 From: mstembera Date: Mon, 26 May 2025 18:26:31 -0700 Subject: [PATCH] Remove unused threatenedPieces threatenedPieces is no longer used since #6023 Also can_move_king_or_pawn() can be const. Also remove a couple of redundant declarations. closes https://github.com/official-stockfish/Stockfish/pull/6101 No functional change --- src/movepick.cpp | 11 +++-------- src/movepick.h | 2 +- src/nnue/nnue_common.h | 1 - src/timeman.cpp | 2 -- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/movepick.cpp b/src/movepick.cpp index faef753b..d2764fa8 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -128,18 +128,13 @@ void MovePicker::score() { Color us = pos.side_to_move(); - [[maybe_unused]] Bitboard threatenedPieces, threatByLesser[QUEEN + 1]; + [[maybe_unused]] Bitboard threatByLesser[QUEEN + 1]; if constexpr (Type == QUIETS) { threatByLesser[KNIGHT] = threatByLesser[BISHOP] = pos.attacks_by(~us); threatByLesser[ROOK] = pos.attacks_by(~us) | pos.attacks_by(~us) | threatByLesser[KNIGHT]; threatByLesser[QUEEN] = pos.attacks_by(~us) | threatByLesser[ROOK]; - - // Pieces threatened by pieces of lesser material value - threatenedPieces = (pos.pieces(us, QUEEN) & threatByLesser[QUEEN]) - | (pos.pieces(us, ROOK) & threatByLesser[ROOK]) - | (pos.pieces(us, KNIGHT, BISHOP) & threatByLesser[KNIGHT]); } for (auto& m : *this) @@ -316,11 +311,11 @@ top: void MovePicker::skip_quiet_moves() { skipQuiets = true; } // this function must be called after all quiet moves and captures have been generated -bool MovePicker::can_move_king_or_pawn() { +bool MovePicker::can_move_king_or_pawn() const { // SEE negative captures shouldn't be returned in GOOD_CAPTURE stage assert(stage > GOOD_CAPTURE && stage != EVASION_INIT); - for (ExtMove* m = moves; m < endCur; ++m) + for (const ExtMove* m = moves; m < endCur; ++m) { PieceType movedPieceType = type_of(pos.moved_piece(*m)); if ((movedPieceType == PAWN || movedPieceType == KING) && pos.legal(*m)) diff --git a/src/movepick.h b/src/movepick.h index 2634fdd7..b6784fb7 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -50,7 +50,7 @@ class MovePicker { MovePicker(const Position&, Move, int, const CapturePieceToHistory*); Move next_move(); void skip_quiet_moves(); - bool can_move_king_or_pawn(); + bool can_move_king_or_pawn() const; private: template diff --git a/src/nnue/nnue_common.h b/src/nnue/nnue_common.h index 35cc8a5f..550bcaad 100644 --- a/src/nnue/nnue_common.h +++ b/src/nnue/nnue_common.h @@ -81,7 +81,6 @@ constexpr std::size_t MaxSimdWidth = 32; // Type of input feature after conversion using TransformedFeatureType = std::uint8_t; -using IndexType = std::uint32_t; // Round n up to be a multiple of base template diff --git a/src/timeman.cpp b/src/timeman.cpp index f0894a26..29ebffca 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -28,8 +28,6 @@ namespace Stockfish { -enum Color : int8_t; - TimePoint TimeManagement::optimum() const { return optimumTime; } TimePoint TimeManagement::maximum() const { return maximumTime; }