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:
Marco Costalba
2012-02-12 16:02:13 +01:00
parent 099b5e45e6
commit 7b4b65d7a9
5 changed files with 43 additions and 59 deletions

View File

@@ -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<>