]> git.sesse.net Git - stockfish/blobdiff - src/movegen.cpp
Simplify and micro-optimize hidden_checkers()
[stockfish] / src / movegen.cpp
index c9255f31eb4e5245b867c0694d2d358a72dc77a0..5b8f2e9a8a1103410b740488cf2f88d793c72f25 100644 (file)
@@ -362,7 +362,6 @@ namespace {
   inline MoveStack* generate_promotions(const Position& pos, MoveStack* mlist, Bitboard pawnsOn7, Bitboard target) {
 
     const Bitboard TFileABB = (Delta == DELTA_NE || Delta == DELTA_SE ? FileABB : FileHBB);
-    const Color Them = (Delta > 0 ? BLACK : WHITE);
 
     Bitboard b;
     Square to;
@@ -390,7 +389,7 @@ namespace {
         // This is the only possible under promotion that can give a check
         // not already included in the queen-promotion.
         if (   Type == MV_CHECK
-            && bit_is_set(pos.attacks_from<KNIGHT>(to), pos.king_square(Them)))
+            && bit_is_set(pos.attacks_from<KNIGHT>(to), pos.king_square(Delta > 0 ? BLACK : WHITE)))
             (*mlist++).move = make_promotion_move(to - Delta, to, KNIGHT);
         else (void)pos; // Silence a warning under MSVC
     }