From 9e4ba8fe98eb29166ba200310659483238c25846 Mon Sep 17 00:00:00 2001 From: Fabian Fichter Date: Fri, 26 Feb 2021 17:52:49 +0100 Subject: [PATCH] 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 --- src/position.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) 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 -- 1.7.0.4