-inline Bitboard behind_bb(Color c, Rank r) {
- return InFrontBB[opposite_color(c)][r];
-}
-
-inline Bitboard behind_bb(Color c, Square s) {
- return in_front_bb(opposite_color(c), square_rank(s));
-}
-
-
-/// ray_bb() gives a bitboard representing all squares along the ray in a
-/// given direction from a given square.
-
-inline Bitboard ray_bb(Square s, SignedDirection d) {
- return RayBB[s][d];
-}
-
-
-/// Functions for computing sliding attack bitboards. rook_attacks_bb(),
-/// bishop_attacks_bb() and queen_attacks_bb() all take a square and a
-/// bitboard of occupied squares as input, and return a bitboard representing
-/// all squares attacked by a rook, bishop or queen on the given square.
-
-#if defined(USE_COMPACT_ROOK_ATTACKS)
-
-inline Bitboard file_attacks_bb(Square s, Bitboard blockers) {
- Bitboard b = (blockers >> square_file(s)) & 0x01010101010100ULL;
- return
- FileAttacks[square_rank(s)][(b*0xd6e8802041d0c441ULL)>>58] & file_bb(s);
-}
-
-inline Bitboard rank_attacks_bb(Square s, Bitboard blockers) {
- Bitboard b = (blockers >> ((s & 56) + 1)) & 63;
- return RankAttacks[square_file(s)][b] & rank_bb(s);
-}
-
-inline Bitboard rook_attacks_bb(Square s, Bitboard blockers) {
- return file_attacks_bb(s, blockers) | rank_attacks_bb(s, blockers);
-}
-
-#elif defined(USE_32BIT_ATTACKS)
-
-inline Bitboard rook_attacks_bb(Square s, Bitboard blockers) {
- Bitboard b = blockers & RMask[s];
- return RAttacks[RAttackIndex[s] +
- (unsigned(int(b) * int(RMult[s]) ^
- int(b >> 32) * int(RMult[s] >> 32))
- >> RShift[s])];
-}
-
-#else
-
-inline Bitboard rook_attacks_bb(Square s, Bitboard blockers) {
- Bitboard b = blockers & RMask[s];
- return RAttacks[RAttackIndex[s] + ((b * RMult[s]) >> RShift[s])];