-#else // if !defined(IS_64BIT)
-
-FORCE_INLINE unsigned rook_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 bishop_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][rook_index(s, occ)];
-}
-
-inline Bitboard bishop_attacks_bb(Square s, Bitboard occ) {
- return BAttacks[s][bishop_index(s, occ)];
-}
-
-inline Bitboard queen_attacks_bb(Square s, Bitboard blockers) {
- return rook_attacks_bb(s, blockers) | bishop_attacks_bb(s, blockers);
+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)];