}
+const Bitboard FileABB = 0x0101010101010101ULL;
+const Bitboard FileBBB = FileABB << 1;
+const Bitboard FileCBB = FileABB << 2;
+const Bitboard FileDBB = FileABB << 3;
+const Bitboard FileEBB = FileABB << 4;
+const Bitboard FileFBB = FileABB << 5;
+const Bitboard FileGBB = FileABB << 6;
+const Bitboard FileHBB = FileABB << 7;
+
+const Bitboard Rank1BB = 0xFF;
+const Bitboard Rank2BB = Rank1BB << (8 * 1);
+const Bitboard Rank3BB = Rank1BB << (8 * 2);
+const Bitboard Rank4BB = Rank1BB << (8 * 3);
+const Bitboard Rank5BB = Rank1BB << (8 * 4);
+const Bitboard Rank6BB = Rank1BB << (8 * 5);
+const Bitboard Rank7BB = Rank1BB << (8 * 6);
+const Bitboard Rank8BB = Rank1BB << (8 * 7);
+
CACHE_LINE_ALIGNMENT
extern Bitboard RMasks[SQUARE_NB];
extern Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB];
extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB];
+extern int SquareDistance[SQUARE_NB][SQUARE_NB];
+
const Bitboard BlackSquares = 0xAA55AA55AA55AA55ULL;
/// Overloads of bitwise operators between a Bitboard and a Square for testing
return b ^ SquareBB[s];
}
-
-/// more_than_one() returns true if in 'b' there is more than one bit set
-
inline bool more_than_one(Bitboard b) {
return b & (b - 1);
}
+inline int square_distance(Square s1, Square s2) {
+ return SquareDistance[s1][s2];
+}
+
+inline int file_distance(Square s1, Square s2) {
+ return abs(file_of(s1) - file_of(s2));
+}
+
+inline int rank_distance(Square s1, Square s2) {
+ return abs(rank_of(s1) - rank_of(s2));
+}
+
/// shift_bb() moves bitboard one step along direction Delta. Mainly for pawns.