-inline Bitboard this_and_neighboring_files_bb(Square s) {
- return this_and_neighboring_files_bb(square_file(s));
+
+/// between_bb() returns a bitboard representing squares that are linearly
+/// between the two given squares (excluding the given squares). If the given
+/// squares are not on a same file/rank/diagonal, we return 0. For instance,
+/// between_bb(SQ_C4, SQ_F7) will return a bitboard with squares D5 and E6.
+
+inline Bitboard between_bb(Square s1, Square s2) {
+ Bitboard b = line_bb(s1, s2) & ((AllSquares << s1) ^ (AllSquares << s2));
+ return b & (b - 1); //exclude lsb