X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmovegen.cpp;h=a783a6251b8b7ca6319d127cb7b1eb8842fa8dbb;hp=cbb71688d20a6c9eaa11475e4e9aa505ffdc2d18;hb=980124c6094f90741a250a40c160efb593244ffb;hpb=5f7d37273caf4256d10c0b92e68c397c398fedd1 diff --git a/src/movegen.cpp b/src/movegen.cpp index cbb71688..a783a625 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -835,23 +835,23 @@ namespace { // Direct checks b = target & ~dc; - if (Piece == KING || !b) - return mlist; - - Bitboard checkSqs = pos.piece_attacks(ksq) & pos.empty_squares(); - if (!checkSqs) - return mlist; - - while (b) + if (Piece != KING || b) { - Square from = pop_1st_bit(&b); - if ( (Piece == QUEEN && !(QueenPseudoAttacks[from] & checkSqs)) - || (Piece == ROOK && !(RookPseudoAttacks[from] & checkSqs)) - || (Piece == BISHOP && !(BishopPseudoAttacks[from] & checkSqs))) - continue; + Bitboard checkSqs = pos.piece_attacks(ksq) & pos.empty_squares(); + if (!checkSqs) + return mlist; - Bitboard bb = pos.piece_attacks(from) & checkSqs; - SERIALIZE_MOVES(bb); + while (b) + { + Square from = pop_1st_bit(&b); + if ( (Piece == QUEEN && !(QueenPseudoAttacks[from] & checkSqs)) + || (Piece == ROOK && !(RookPseudoAttacks[from] & checkSqs)) + || (Piece == BISHOP && !(BishopPseudoAttacks[from] & checkSqs))) + continue; + + Bitboard bb = pos.piece_attacks(from) & checkSqs; + SERIALIZE_MOVES(bb); + } } return mlist; }