- // Update checkers bitboard: piece must be already moved due to attacks_from()
- st->checkersBB = 0;
-
- if (givesCheck)
- {
- if (type_of(m) != NORMAL)
- st->checkersBB = attackers_to(king_square(them)) & pieces(us);
- else
- {
- // Direct checks
- if (ci.checkSq[pt] & to)
- st->checkersBB |= to;
-
- // Discovered checks
- if (ci.dcCandidates && (ci.dcCandidates & from))
- {
- assert(pt != QUEEN);
-
- if (pt != ROOK)
- st->checkersBB |= attacks_from<ROOK>(king_square(them)) & pieces(us, QUEEN, ROOK);
-
- if (pt != BISHOP)
- st->checkersBB |= attacks_from<BISHOP>(king_square(them)) & pieces(us, QUEEN, BISHOP);
- }
- }
- }
+ // Calculate checkers bitboard (if move gives check)
+ st->checkersBB = givesCheck ? attackers_to(king_square(them)) & pieces(us) : 0;