X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbitboard.h;h=53e96f4455478e176f79b2c98b28799a5e7f6bee;hb=6373fd56e90bc6114230a70cacad804248d955e2;hp=b1d961f4d9fc2b018a9084e66510004b7594a779;hpb=f98c77413b68d506977bc078de7a47455968a926;p=stockfish diff --git a/src/bitboard.h b/src/bitboard.h index b1d961f4..53e96f44 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -69,7 +69,6 @@ extern uint8_t PopCnt16[1 << 16]; extern uint8_t SquareDistance[SQUARE_NB][SQUARE_NB]; extern Bitboard LineBB[SQUARE_NB][SQUARE_NB]; -extern Bitboard DistanceRingBB[SQUARE_NB][8]; extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB]; extern Bitboard PawnAttacks[COLOR_NB][SQUARE_NB]; extern Bitboard KingFlank[FILE_NB]; @@ -237,15 +236,13 @@ inline bool aligned(Square s1, Square s2, Square s3) { /// distance() functions return the distance between x and y, defined as the -/// number of steps for a king in x to reach y. Works with squares, ranks, files. +/// number of steps for a king in x to reach y. -template inline int distance(T x, T y) { return std::abs(x - y); } +template inline int distance(Square x, Square y); +template<> inline int distance(Square x, Square y) { return std::abs(file_of(x) - file_of(y)); } +template<> inline int distance(Square x, Square y) { return std::abs(rank_of(x) - rank_of(y)); } template<> inline int distance(Square x, Square y) { return SquareDistance[x][y]; } -template inline int distance(T2 x, T2 y); -template<> inline int distance(Square x, Square y) { return distance(file_of(x), file_of(y)); } -template<> inline int distance(Square x, Square y) { return distance(rank_of(x), rank_of(y)); } - template constexpr const T& clamp(const T& v, const T& lo, const T& hi) { return v < lo ? lo : v > hi ? hi : v; }