Small speed-up in check detection
authorFabian Fichter <ianfab@users.noreply.github.com>
Thu, 31 Jan 2019 22:13:20 +0000 (23:13 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Thu, 31 Jan 2019 22:13:20 +0000 (23:13 +0100)
Since pieces can not give check against own king.

No functional change.

src/position.cpp

index 2b1863b..2b52675 100644 (file)
@@ -1233,7 +1233,7 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
   st->key = k;
 
   // Calculate checkers bitboard (if move gives check)
-  st->checkersBB = givesCheck ? attackers_to(square<KING>(them)) & pieces(us) : 0;
+  st->checkersBB = givesCheck ? attackers_to(square<KING>(them), us) & pieces(us) : 0;
 
   // Update information about promoted pieces
   if (type_of(m) != DROP && is_promoted(from))