]> git.sesse.net Git - stockfish/commitdiff
Micro-optimize pl_move_is_legal()
authorMarco Costalba <mcostalba@gmail.com>
Tue, 17 May 2011 22:44:55 +0000 (23:44 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Tue, 17 May 2011 22:47:26 +0000 (23:47 +0100)
Remove the check for castling moves because it is
already implicit in the check for king moves and castling
is so rare that doing the check is just a slow down.

Thanks to Marek Kwiatkowski.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/position.cpp

index a9c98626980fa56bbf5995e2c0d186f342fddef2..59caa88e47e4b0bcc8220b4c9d8617b23f799946 100644 (file)
@@ -570,10 +570,6 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
   assert(move_is_ok(m));
   assert(pinned == pinned_pieces(side_to_move()));
 
   assert(move_is_ok(m));
   assert(pinned == pinned_pieces(side_to_move()));
 
-  // Castling moves are checked for legality during move generation.
-  if (move_is_castle(m))
-      return true;
-
   // En passant captures are a tricky special case. Because they are
   // rather uncommon, we do it simply by testing whether the king is attacked
   // after the move is made
   // En passant captures are a tricky special case. Because they are
   // rather uncommon, we do it simply by testing whether the king is attacked
   // after the move is made