-template<typename T> inline int distance(T x, T y) { return x < y ? y - x : x - y; }
-template<> inline int distance<Square>(Square x, Square y) { return SquareDistance[x][y]; }
-
-template<typename T1, typename T2> inline int distance(T2 x, T2 y);
-template<> inline int distance<File>(Square x, Square y) { return distance(file_of(x), file_of(y)); }
-template<> inline int distance<Rank>(Square x, Square y) { return distance(rank_of(x), rank_of(y)); }
-
-
-/// shift_bb() moves bitboard one step along direction Delta. Mainly for pawns.
-
-template<Square Delta>
-inline Bitboard shift_bb(Bitboard b) {
-
- return Delta == DELTA_N ? b << 8 : Delta == DELTA_S ? b >> 8
- : Delta == DELTA_NE ? (b & ~FileHBB) << 9 : Delta == DELTA_SE ? (b & ~FileHBB) >> 7
- : Delta == DELTA_NW ? (b & ~FileABB) << 7 : Delta == DELTA_SW ? (b & ~FileABB) >> 9
- : 0;
+inline Bitboard& operator^=(Bitboard& b, Square s) {
+ return b ^= SquareBB[s];