-#else // if !defined(IS_64BIT)
-
-FORCE_INLINE unsigned r_index(Square s, Bitboard occ) {
- Bitboard b = occ & RMasks[s];
- return unsigned(int(b) * int(RMagics[s]) ^ int(b >> 32) * int(RMagics[s] >> 32)) >> RShifts[s];
-}
-
-FORCE_INLINE unsigned b_index(Square s, Bitboard occ) {
- Bitboard b = occ & BMasks[s];
- return unsigned(int(b) * int(BMagics[s]) ^ int(b >> 32) * int(BMagics[s] >> 32)) >> BShifts[s];
-}
-
-#endif
-
-inline Bitboard rook_attacks_bb(Square s, Bitboard occ) {
- return RAttacks[s][r_index(s, occ)];
-}
-
-inline Bitboard bishop_attacks_bb(Square s, Bitboard occ) {
- return BAttacks[s][b_index(s, occ)];
+template<PieceType Pt>
+inline Bitboard attacks_bb(Square s, Bitboard occ) {
+ Bitboard** const Attacks = Pt == ROOK ? RAttacks : BAttacks;
+ return Attacks[s][magic_index<Pt>(s, occ)];