]> git.sesse.net Git - stockfish/blobdiff - src/movegen.cpp
Remove two useless calls to pinned_pieces()
[stockfish] / src / movegen.cpp
index 94bc173e10c94f142043a2ff5c94726f8b3371a0..37e66724e5decd81e25a8eaecd552264f200e2c1 100644 (file)
@@ -349,8 +349,6 @@ int generate_legal_moves(const Position& pos, MoveStack* mlist) {
 
   assert(pos.is_ok());
 
-  Bitboard pinned = pos.pinned_pieces(pos.side_to_move());
-
   if (pos.is_check())
       return generate_evasions(pos, mlist);
 
@@ -360,7 +358,7 @@ int generate_legal_moves(const Position& pos, MoveStack* mlist) {
 
   // Remove illegal moves from the list
   for (int i = 0; i < n; i++)
-      if (!pos.pl_move_is_legal(mlist[i].move, pinned))
+      if (!pos.pl_move_is_legal(mlist[i].move))
           mlist[i--].move = mlist[--n].move;
 
   return n;
@@ -383,7 +381,6 @@ bool move_is_legal(const Position& pos, const Move m) {
   Color them = opposite_color(us);
   Square from = move_from(m);
   Piece pc = pos.piece_on(from);
-  Bitboard pinned = pos.pinned_pieces(us);
 
   // If the from square is not occupied by a piece belonging to the side to
   // move, the move is obviously not legal.
@@ -405,7 +402,7 @@ bool move_is_legal(const Position& pos, const Move m) {
       assert(pos.piece_on(to - pawn_push(us)) == piece_of_color_and_type(them, PAWN));
 
       // The move is pseudo-legal, check if it is also legal
-      return pos.pl_move_is_legal(m, pinned);
+      return pos.pl_move_is_legal(m);
   }
 
   // Castling moves
@@ -537,12 +534,12 @@ bool move_is_legal(const Position& pos, const Move m) {
           return false;
       }
       // The move is pseudo-legal, check if it is also legal
-      return pos.pl_move_is_legal(m, pinned);
+      return pos.pl_move_is_legal(m);
   }
 
   // Luckly we can handle all the other pieces in one go
   return (   pos.piece_attacks_square(pos.piece_on(from), from, to)
-          && pos.pl_move_is_legal(m, pinned)
+          && pos.pl_move_is_legal(m)
           && !move_promotion(m));
 }