]> git.sesse.net Git - stockfish/commitdiff
Remove redundant condition from capture_stage()
authormstembera <MissingEmail@email>
Sat, 11 Mar 2023 19:51:08 +0000 (11:51 -0800)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Tue, 14 Mar 2023 07:29:19 +0000 (08:29 +0100)
Change a non functional promotion check to an assert.

closes https://github.com/official-stockfish/Stockfish/pull/4436

No functional change

src/position.cpp
src/position.h

index 37aa2e9edec97b3812f646d4f38da67168e0b4a5..632a40b5d617658dbb6bb188a4d6e12ca4b96449 100644 (file)
@@ -569,8 +569,7 @@ bool Position::pseudo_legal(const Move m) const {
                         : MoveList<NON_EVASIONS>(*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.
index 1fc6b3b89c4ab2726b9605d5afc50a326e969bfc..cc606a5ab00af8dcb0d7a6dbed9ec326997b7222 100644 (file)
@@ -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 {