Revert previous patch due to miscompile under gcc
authorMarco Costalba <mcostalba@gmail.com>
Thu, 10 Mar 2011 07:07:07 +0000 (08:07 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 10 Mar 2011 07:08:04 +0000 (08:08 +0100)
I need to understand what's going on, in the
meantime revert.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/bitboard.cpp
src/bitboard.h

index 54cc94f..bc05bfa 100644 (file)
@@ -156,6 +156,51 @@ const int RShift[64] = {
 
 #endif // defined(IS_64BIT)
 
+static const Bitboard DarkSquaresBB  = 0xAA55AA55AA55AA55ULL;
+
+const Bitboard SquaresByColorBB[2] = { DarkSquaresBB, ~DarkSquaresBB };
+
+const Bitboard FileBB[8] = {
+  FileABB, FileBBB, FileCBB, FileDBB, FileEBB, FileFBB, FileGBB, FileHBB
+};
+
+const Bitboard NeighboringFilesBB[8] = {
+  FileBBB, FileABB|FileCBB, FileBBB|FileDBB, FileCBB|FileEBB,
+  FileDBB|FileFBB, FileEBB|FileGBB, FileFBB|FileHBB, FileGBB
+};
+
+const Bitboard ThisAndNeighboringFilesBB[8] = {
+  FileABB|FileBBB, FileABB|FileBBB|FileCBB,
+  FileBBB|FileCBB|FileDBB, FileCBB|FileDBB|FileEBB,
+  FileDBB|FileEBB|FileFBB, FileEBB|FileFBB|FileGBB,
+  FileFBB|FileGBB|FileHBB, FileGBB|FileHBB
+};
+
+const Bitboard RankBB[8] = {
+  Rank1BB, Rank2BB, Rank3BB, Rank4BB, Rank5BB, Rank6BB, Rank7BB, Rank8BB
+};
+
+const Bitboard InFrontBB[2][8] = {
+  { Rank2BB | Rank3BB | Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
+    Rank3BB | Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
+    Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB,
+    Rank5BB | Rank6BB | Rank7BB | Rank8BB,
+    Rank6BB | Rank7BB | Rank8BB,
+    Rank7BB | Rank8BB,
+    Rank8BB,
+    EmptyBoardBB
+  },
+  { EmptyBoardBB,
+    Rank1BB,
+    Rank2BB | Rank1BB,
+    Rank3BB | Rank2BB | Rank1BB,
+    Rank4BB | Rank3BB | Rank2BB | Rank1BB,
+    Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB,
+    Rank6BB | Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB,
+    Rank7BB | Rank6BB | Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB
+  }
+};
+
 // Global bitboards definitions with static storage duration are
 // automatically set to zero before enter main().
 Bitboard RMask[64];
@@ -169,14 +214,9 @@ Bitboard BAttacks[0x1480];
 Bitboard SetMaskBB[65];
 Bitboard ClearMaskBB[65];
 
-Bitboard SquaresByColorBB[2];
-Bitboard FileBB[8];
-Bitboard RankBB[8];
-Bitboard NeighboringFilesBB[8];
-Bitboard ThisAndNeighboringFilesBB[8];
-Bitboard InFrontBB[2][8];
 Bitboard NonSlidingAttacksBB[16][64];
 Bitboard BetweenBB[64][64];
+
 Bitboard SquaresInFrontMask[2][64];
 Bitboard PassedPawnMask[2][64];
 Bitboard AttackSpanMask[2][64];
@@ -323,30 +363,6 @@ namespace {
 
   void init_masks() {
 
-    SquaresByColorBB[DARK]  =  0xAA55AA55AA55AA55ULL;
-    SquaresByColorBB[LIGHT] = ~SquaresByColorBB[DARK];
-
-    FileBB[FILE_A] = FileABB;
-    RankBB[RANK_1] = Rank1BB;
-
-    for (File f = FILE_B; f <= FILE_H; f++)
-    {
-        FileBB[f] = FileBB[f - 1] << 1;
-        RankBB[f] = RankBB[f - 1] << 8;
-    }
-
-    for (File f = FILE_A; f <= FILE_H; f++)
-    {
-        NeighboringFilesBB[f] = (f > FILE_A ? FileBB[f - 1] : 0) | (f < FILE_H ? FileBB[f + 1] : 0);
-        ThisAndNeighboringFilesBB[f] = FileBB[f] | NeighboringFilesBB[f];
-    }
-
-    for (Rank rw = RANK_7, rb = RANK_1; rw >= RANK_1; rw--, rb++)
-    {
-        InFrontBB[WHITE][rw] = InFrontBB[WHITE][rw + 1] | RankBB[rw + 1];
-        InFrontBB[BLACK][rb] = InFrontBB[BLACK][rb - 1] | RankBB[rb - 1];
-    }
-
     SetMaskBB[SQ_NONE] = EmptyBoardBB;
     ClearMaskBB[SQ_NONE] = ~SetMaskBB[SQ_NONE];
 
index 7f0fdb5..b962226 100644 (file)
@@ -43,12 +43,12 @@ const Bitboard Rank6BB = Rank1BB << (8 * 5);
 const Bitboard Rank7BB = Rank1BB << (8 * 6);
 const Bitboard Rank8BB = Rank1BB << (8 * 7);
 
-extern Bitboard SquaresByColorBB[2];
-extern Bitboard FileBB[8];
-extern Bitboard NeighboringFilesBB[8];
-extern Bitboard ThisAndNeighboringFilesBB[8];
-extern Bitboard RankBB[8];
-extern Bitboard InFrontBB[2][8];
+extern const Bitboard SquaresByColorBB[2];
+extern const Bitboard FileBB[8];
+extern const Bitboard NeighboringFilesBB[8];
+extern const Bitboard ThisAndNeighboringFilesBB[8];
+extern const Bitboard RankBB[8];
+extern const Bitboard InFrontBB[2][8];
 
 extern Bitboard SetMaskBB[65];
 extern Bitboard ClearMaskBB[65];