From: Fabian Fichter Date: Fri, 26 Feb 2021 16:52:49 +0000 (+0100) Subject: Speed up move generation X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=9e4ba8fe98eb29166ba200310659483238c25846;p=fairystockfish.git Speed up move generation standard STC LLR: -2.97 (-2.94,2.94) [0.00,10.00] Total: 7654 W: 1715 L: 1705 D: 4234 http://www.variantfishtest.org:6543/tests/view/60341b906e23db669974e955 seirawan STC LLR: -2.97 (-2.94,2.94) [0.00,10.00] Total: 7286 W: 2480 L: 2464 D: 2342 http://www.variantfishtest.org:6543/tests/view/6034b1936e23db669974e962 minishogi STC LLR: -2.96 (-2.94,2.94) [0.00,10.00] Total: 9644 W: 4840 L: 4804 D: 0 http://www.variantfishtest.org:6543/tests/view/6034b1796e23db669974e960 bench: 4387985 --- diff --git a/src/position.h b/src/position.h index 42022e2..5ac26ef 100644 --- a/src/position.h +++ b/src/position.h @@ -976,6 +976,9 @@ inline Square Position::castling_rook_square(CastlingRights cr) const { } inline Bitboard Position::attacks_from(Color c, PieceType pt, Square s) const { + if (var->fastAttacks || var->fastAttacks2) + return attacks_bb(c, pt, s, byTypeBB[ALL_PIECES]) & board_bb(); + PieceType movePt = pt == KING ? king_type() : pt; Bitboard b = attacks_bb(c, movePt, s, byTypeBB[ALL_PIECES]); // Xiangqi soldier @@ -1004,6 +1007,9 @@ inline Bitboard Position::attacks_from(Color c, PieceType pt, Square s) const { } inline Bitboard Position::moves_from(Color c, PieceType pt, Square s) const { + if (var->fastAttacks || var->fastAttacks2) + return moves_bb(c, pt, s, byTypeBB[ALL_PIECES]) & board_bb(); + PieceType movePt = pt == KING ? king_type() : pt; Bitboard b = moves_bb(c, movePt, s, byTypeBB[ALL_PIECES]); // Xiangqi soldier