]> git.sesse.net Git - stockfish/blobdiff - src/bitboard.cpp
Retire do_capture_move()
[stockfish] / src / bitboard.cpp
index de28e03a05c4ef345ab0d89db30d206046811637..3bed69bead7665dc9a51e53f29008d67ab8fda9e 100644 (file)
@@ -56,6 +56,7 @@ Bitboard RookPseudoAttacks[64];
 Bitboard QueenPseudoAttacks[64];
 
 uint8_t BitCount8Bit[256];
+int SquareDistance[64][64];
 
 namespace {
 
@@ -154,6 +155,13 @@ Square pop_1st_bit(Bitboard* bb) {
 
 void init_bitboards() {
 
+  for (Bitboard b = 0; b < 256; b++)
+      BitCount8Bit[b] = (uint8_t)count_1s<CNT32_MAX15>(b);
+
+  for (Square s1 = SQ_A1; s1 <= SQ_H8; s1++)
+      for (Square s2 = SQ_A1; s2 <= SQ_H8; s2++)
+          SquareDistance[s1][s2] = Max(file_distance(s1, s2), rank_distance(s1, s2));
+
   SquaresByColorBB[DARK]  =  0xAA55AA55AA55AA55ULL;
   SquaresByColorBB[LIGHT] = ~SquaresByColorBB[DARK];
 
@@ -194,9 +202,6 @@ void init_bitboards() {
           AttackSpanMask[c][s]     = in_front_bb(c, s) & neighboring_files_bb(s);
       }
 
-  for (Bitboard b = 0; b < 256; b++)
-      BitCount8Bit[b] = (uint8_t)count_1s<CNT32_MAX15>(b);
-
   for (int i = 0; i < 64; i++)
       if (!CpuIs64Bit) // Matt Taylor's folding trick for 32 bit systems
       {
@@ -320,7 +325,7 @@ namespace {
         } while (b);
 
         offset += maxKey;
-        booster = MagicBoosters[CpuIs64Bit][square_rank(s)];
+        booster = MagicBoosters[CpuIs64Bit][rank_of(s)];
 
         // Then find a possible magic and the corresponding attacks
         do {