mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 01:27:16 +08:00
Templetize sliding attacks
No functional change and no speed regression, it seems to be even a bit faster on MSVC and gcc. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -345,10 +345,9 @@ inline Square Position::castle_rook_square(CastleRight f) const {
|
||||
|
||||
template<PieceType Pt>
|
||||
inline Bitboard Position::attacks_from(Square s) const {
|
||||
return Pt == BISHOP ? bishop_attacks_bb(s, occupied_squares())
|
||||
: Pt == ROOK ? rook_attacks_bb(s, occupied_squares())
|
||||
return Pt == BISHOP || Pt == ROOK ? attacks_bb<Pt>(s, occupied_squares())
|
||||
: Pt == QUEEN ? attacks_from<ROOK>(s) | attacks_from<BISHOP>(s)
|
||||
: StepAttacksBB[Pt][s];
|
||||
: StepAttacksBB[Pt][s];
|
||||
}
|
||||
|
||||
template<>
|
||||
|
||||
Reference in New Issue
Block a user