From 24485c96ec7dcb743c1dac8cf0cccc96456893d9 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 19 Apr 2009 21:09:53 +0200 Subject: [PATCH] Micro optimize generate_piece_checks() take 2 Add some missing bits of this patch. Signed-off-by: Marco Costalba --- src/movegen.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/movegen.cpp b/src/movegen.cpp index d2b55bd2..dff9e8c3 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -73,9 +73,8 @@ namespace { return Us == WHITE ? p << 9 : p >> 7; else if (Direction == DELTA_NW) return Us == WHITE ? p << 7 : p >> 9; - - assert(false); - return p; + else + return p; } // Template generate_piece_checks() with specializations @@ -821,6 +820,11 @@ namespace { 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); } -- 2.39.2