X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=inline;f=src%2Fposition.cpp;h=ef5fd97091cc4f0f478b41954090ba8e72a1799f;hb=3b49aeb4f22569c2b5d5ca830858c4dd584fae7f;hp=045b10cab7c276b8fc3806a09c4751c33fdf2523;hpb=423c6d8a8a36fcc56d421caf0bbc12f53ba62c30;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index 045b10ca..ef5fd970 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -521,20 +521,6 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const { } -/// Position::move_is_legal() takes a random move and tests whether the move -/// is legal. This version is not very fast and should be used only in non -/// time-critical paths. - -bool Position::move_is_legal(const Move m) const { - - for (MoveList ml(*this); !ml.end(); ++ml) - if (ml.move() == m) - return true; - - return false; -} - - /// Position::is_pseudo_legal() takes a random move and tests whether the move /// is pseudo legal. It is used to validate moves from TT that can be corrupted /// due to SMP concurrent access or hash position key aliasing. @@ -548,7 +534,7 @@ bool Position::is_pseudo_legal(const Move m) const { // Use a slower but simpler function for uncommon cases if (type_of(m) != NORMAL) - return move_is_legal(m); + return MoveList(*this).contains(m); // Is not a promotion, so promotion piece must be empty if (promotion_type(m) - 2 != NO_PIECE_TYPE)