Performance improvement for small board sizes
authorianfab <ianfab@users.noreply.github.com>
Sun, 22 Jul 2018 11:22:55 +0000 (13:22 +0200)
committerianfab <ianfab@users.noreply.github.com>
Sun, 22 Jul 2018 11:22:55 +0000 (13:22 +0200)
Filter out illegal moves early.

No functional change.

src/movegen.cpp

index 2a84d87..ba1656c 100644 (file)
@@ -338,6 +338,7 @@ ExtMove* generate(const Position& pos, ExtMove* moveList) {
   Bitboard target =  Type == CAPTURES     ?  pos.pieces(~us)
                    : Type == QUIETS       ? ~pos.pieces()
                    : Type == NON_EVASIONS ? ~pos.pieces(us) : 0;
+  target &= pos.board_bb();
 
   return us == WHITE ? generate_all<WHITE, Type>(pos, moveList, target)
                      : generate_all<BLACK, Type>(pos, moveList, target);