}
-/// shift() moves a bitboard one step along direction D
+/// shift() moves a bitboard one or two steps as specified by the direction D
template<Direction D>
constexpr Bitboard shift(Bitboard b) {
/// If the given squares are not on a same file/rank/diagonal, return 0.
inline Bitboard between_bb(Square s1, Square s2) {
- return LineBB[s1][s2] & ( (AllSquares << (s1 + (s1 < s2)))
- ^(AllSquares << (s2 + !(s1 < s2))));
+ Bitboard b = LineBB[s1][s2] & ((AllSquares << s1) ^ (AllSquares << s2));
+ return b & (b - 1); //exclude lsb
}