Templetize sliding attacks
[stockfish] / src / position.h
index 8229e71b4a1a4e8c3c66f7cdcd12cbaa580635b2..e471baea099029c5b7d72dbb9d472a9d780b462a 100644 (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<>