]> git.sesse.net Git - stockfish/commitdiff
Move SquareDistance[] to bitboard.cpp
authorMarco Costalba <mcostalba@gmail.com>
Sun, 23 Jun 2013 11:08:10 +0000 (13:08 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 23 Jun 2013 11:13:13 +0000 (13:13 +0200)
No functional change.

src/bitboard.h
src/types.h

index 6094c343f45236772abe34b7a2775641e3dec405..033964b75b3d9c657e997d5e9b9b566284303172 100644 (file)
@@ -80,6 +80,8 @@ extern Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB];
 extern Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB];
 extern Bitboard PseudoAttacks[PIECE_TYPE_NB][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
 const Bitboard BlackSquares = 0xAA55AA55AA55AA55ULL;
 
 /// Overloads of bitwise operators between a Bitboard and a Square for testing
@@ -105,13 +107,22 @@ inline Bitboard operator^(Bitboard b, Square s) {
   return b ^ SquareBB[s];
 }
 
   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 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.
 
 
 /// shift_bb() moves bitboard one step along direction Delta. Mainly for pawns.
 
index c5b901a98d4e64603b60446c522ec4884fa04627..444d7afd3d08eeab3132c389c155cae066a1ccd5 100644 (file)
@@ -310,7 +310,6 @@ inline Score operator/(Score s, int i) {
 #undef ENABLE_SAFE_OPERATORS_ON
 
 extern Value PieceValue[PHASE_NB][PIECE_NB];
 #undef ENABLE_SAFE_OPERATORS_ON
 
 extern Value PieceValue[PHASE_NB][PIECE_NB];
-extern int SquareDistance[SQUARE_NB][SQUARE_NB];
 
 struct MoveStack {
   Move move;
 
 struct MoveStack {
   Move move;
@@ -391,18 +390,6 @@ inline bool opposite_colors(Square s1, Square s2) {
   return ((s >> 3) ^ s) & 1;
 }
 
   return ((s >> 3) ^ s) & 1;
 }
 
-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));
-}
-
-inline int square_distance(Square s1, Square s2) {
-  return SquareDistance[s1][s2];
-}
-
 inline char file_to_char(File f, bool tolower = true) {
   return char(f - FILE_A + (tolower ? 'a' : 'A'));
 }
 inline char file_to_char(File f, bool tolower = true) {
   return char(f - FILE_A + (tolower ? 'a' : 'A'));
 }