From 7077fbdd1481829a0a20b6975c4245609118b938 Mon Sep 17 00:00:00 2001 From: mstembera Date: Sat, 11 Mar 2023 11:51:08 -0800 Subject: [PATCH] Remove redundant condition from capture_stage() Change a non functional promotion check to an assert. closes https://github.com/official-stockfish/Stockfish/pull/4436 No functional change --- src/position.cpp | 3 +-- src/position.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 37aa2e9e..632a40b5 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -569,8 +569,7 @@ bool Position::pseudo_legal(const Move m) const { : MoveList(*this).contains(m); // Is not a promotion, so promotion piece must be empty - if (promotion_type(m) - KNIGHT != NO_PIECE_TYPE) - return false; + assert(promotion_type(m) - KNIGHT == NO_PIECE_TYPE); // If the 'from' square is not occupied by a piece belonging to the side to // move, the move is obviously not legal. diff --git a/src/position.h b/src/position.h index 1fc6b3b8..cc606a5a 100644 --- a/src/position.h +++ b/src/position.h @@ -393,7 +393,7 @@ inline bool Position::capture(Move m) const { // is needed to avoid the generation of duplicate moves. inline bool Position::capture_stage(Move m) const { assert(is_ok(m)); - return capture(m) || (type_of(m) == PROMOTION && promotion_type(m) == QUEEN); + return capture(m) || promotion_type(m) == QUEEN; } inline Piece Position::captured_piece() const { -- 2.39.2