]> git.sesse.net Git - stockfish/commitdiff
Micro optimize generate_piece_checks()
authorMarco Costalba <mcostalba@gmail.com>
Sat, 18 Apr 2009 15:21:44 +0000 (16:21 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sat, 18 Apr 2009 15:28:12 +0000 (16:28 +0100)
Avoid calculating piece attacks if there aren't
available check sqaures for the given piece.

About 15% of cases. Not a biggie but still something
especially in the middle game where king is well covered
inside his castle.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/movegen.cpp

index 0f2f6b4e0fd37d94187eeb05cfde1d6179e1b412..d2b55bd28053f262c2513bdfd17c19a0b307041d 100644 (file)
@@ -815,6 +815,9 @@ namespace {
         return mlist;
 
     Bitboard checkSqs = pos.piece_attacks<Piece>(ksq) & pos.empty_squares();
         return mlist;
 
     Bitboard checkSqs = pos.piece_attacks<Piece>(ksq) & pos.empty_squares();
+    if (!checkSqs)
+        return mlist;
+
     while (b)
     {
         Square from = pop_1st_bit(&b);
     while (b)
     {
         Square from = pop_1st_bit(&b);