]> git.sesse.net Git - stockfish/commitdiff
Small touches in move generation
authorMarco Costalba <mcostalba@gmail.com>
Sun, 21 Jul 2013 09:01:24 +0000 (11:01 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 21 Jul 2013 09:01:24 +0000 (11:01 +0200)
No functional change.

src/movegen.cpp

index a0c06aa8dc6404f1c4b4df109a7fefa6ae0ef67f..76e171f8ab7d2b9e92d89e8046a17db8c0a4e2ae 100644 (file)
@@ -346,10 +346,9 @@ ExtMove* generate<EVASIONS>(const Position& pos, ExtMove* mlist) {
 
   assert(pos.checkers());
 
-  Square from, checksq;
   int checkersCnt = 0;
   Color us = pos.side_to_move();
-  Square ksq = pos.king_square(us);
+  Square ksq = pos.king_square(us), from = ksq /* For SERIALIZE */, checksq;
   Bitboard sliderAttacks = 0;
   Bitboard b = pos.checkers();
 
@@ -388,14 +387,13 @@ ExtMove* generate<EVASIONS>(const Position& pos, ExtMove* mlist) {
 
   // Generate evasions for king, capture and non capture moves
   b = pos.attacks_from<KING>(ksq) & ~pos.pieces(us) & ~sliderAttacks;
-  from = ksq;
   SERIALIZE(b);
 
   if (checkersCnt > 1)
       return mlist; // Double check, only a king move can save the day
 
   // Generate blocking evasions or captures of the checking piece
-  Bitboard target = between_bb(checksq, ksq) | pos.checkers();
+  Bitboard target = between_bb(checksq, ksq) | checksq;
 
   return generate_all<EVASIONS>(pos, mlist, us, target);
 }