]> git.sesse.net Git - stockfish/commitdiff
Retire ThisAndAdjacentFilesBB[]
authorMarco Costalba <mcostalba@gmail.com>
Sun, 23 Jun 2013 08:03:48 +0000 (10:03 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 23 Jun 2013 08:09:24 +0000 (10:09 +0200)
It is unused. Also renamed attack_span_mask to
pawn_attack_span

No functional change.

src/bitboard.cpp
src/bitboard.h
src/evaluate.cpp
src/pawns.cpp

index a3c12ca3d3e9694549fa8cf3759d2b6133f474e2..756f049987db38e7dbad37e52831f055d1a7589d 100644 (file)
@@ -42,14 +42,13 @@ Bitboard SquareBB[SQUARE_NB];
 Bitboard FileBB[FILE_NB];
 Bitboard RankBB[RANK_NB];
 Bitboard AdjacentFilesBB[FILE_NB];
-Bitboard ThisAndAdjacentFilesBB[FILE_NB];
 Bitboard InFrontBB[COLOR_NB][RANK_NB];
 Bitboard StepAttacksBB[PIECE_NB][SQUARE_NB];
 Bitboard BetweenBB[SQUARE_NB][SQUARE_NB];
 Bitboard DistanceRingsBB[SQUARE_NB][8];
 Bitboard ForwardBB[COLOR_NB][SQUARE_NB];
 Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB];
-Bitboard AttackSpanMask[COLOR_NB][SQUARE_NB];
+Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB];
 Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB];
 
 int SquareDistance[SQUARE_NB][SQUARE_NB];
@@ -171,10 +170,7 @@ void Bitboards::init() {
   }
 
   for (File f = FILE_A; f <= FILE_H; f++)
-  {
       AdjacentFilesBB[f] = (f > FILE_A ? FileBB[f - 1] : 0) | (f < FILE_H ? FileBB[f + 1] : 0);
-      ThisAndAdjacentFilesBB[f] = FileBB[f] | AdjacentFilesBB[f];
-  }
 
   for (Rank r = RANK_1; r < RANK_8; r++)
       InFrontBB[WHITE][r] = ~(InFrontBB[BLACK][r + 1] = InFrontBB[BLACK][r] | RankBB[r]);
@@ -183,8 +179,8 @@ void Bitboards::init() {
       for (Square s = SQ_A1; s <= SQ_H8; s++)
       {
           ForwardBB[c][s]      = InFrontBB[c][rank_of(s)] & FileBB[file_of(s)];
-          PassedPawnMask[c][s] = InFrontBB[c][rank_of(s)] & ThisAndAdjacentFilesBB[file_of(s)];
-          AttackSpanMask[c][s] = InFrontBB[c][rank_of(s)] & AdjacentFilesBB[file_of(s)];
+          PawnAttackSpan[c][s] = InFrontBB[c][rank_of(s)] & AdjacentFilesBB[file_of(s)];
+          PassedPawnMask[c][s] = ForwardBB[c][s] | PawnAttackSpan[c][s];
       }
 
   for (Square s1 = SQ_A1; s1 <= SQ_H8; s1++)
index 06adbfe3850512902633fe3b514dff664863bb90..07b0f9ba1c1540ca891b67f9f867bc6698581986 100644 (file)
@@ -53,14 +53,13 @@ extern Bitboard SquareBB[SQUARE_NB];
 extern Bitboard FileBB[FILE_NB];
 extern Bitboard RankBB[RANK_NB];
 extern Bitboard AdjacentFilesBB[FILE_NB];
-extern Bitboard ThisAndAdjacentFilesBB[FILE_NB];
 extern Bitboard InFrontBB[COLOR_NB][RANK_NB];
 extern Bitboard StepAttacksBB[PIECE_NB][SQUARE_NB];
 extern Bitboard BetweenBB[SQUARE_NB][SQUARE_NB];
 extern Bitboard DistanceRingsBB[SQUARE_NB][8];
 extern Bitboard ForwardBB[COLOR_NB][SQUARE_NB];
 extern Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB];
-extern Bitboard AttackSpanMask[COLOR_NB][SQUARE_NB];
+extern Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB];
 extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB];
 
 const Bitboard BlackSquares = 0xAA55AA55AA55AA55ULL;
@@ -136,14 +135,6 @@ inline Bitboard adjacent_files_bb(File f) {
 }
 
 
-/// this_and_adjacent_files_bb takes a file as input and returns a bitboard
-/// representing all squares on the given and adjacent files.
-
-inline Bitboard this_and_adjacent_files_bb(File f) {
-  return ThisAndAdjacentFilesBB[f];
-}
-
-
 /// in_front_bb() takes a color and a rank or square as input, and returns a
 /// bitboard representing all the squares on all ranks in front of the rank
 /// (or square), from the given color's point of view.  For instance,
@@ -194,8 +185,8 @@ inline Bitboard passed_pawn_mask(Color c, Square s) {
 /// when it moves along its file starting from the given square. Definition is:
 /// AttackSpanMask[c][s] = in_front_bb(c, s) & adjacent_files_bb(s);
 
-inline Bitboard attack_span_mask(Color c, Square s) {
-  return AttackSpanMask[c][s];
+inline Bitboard pawn_attack_span(Color c, Square s) {
+  return PawnAttackSpan[c][s];
 }
 
 
index 945fb4e44299dafab044810ac09ae72d4e6c0142..9584c0ed94184b9ab941fa6773f65fef2f55020d 100644 (file)
@@ -530,7 +530,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
 
         // Bishop and knight outposts squares
         if (    (Piece == BISHOP || Piece == KNIGHT)
-            && !(pos.pieces(Them, PAWN) & attack_span_mask(Us, s)))
+            && !(pos.pieces(Them, PAWN) & pawn_attack_span(Us, s)))
             score += evaluate_outposts<Piece, Us>(pos, ei, s);
 
         if (  (Piece == ROOK || Piece == QUEEN)
@@ -999,7 +999,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
             }
 
             // Check pawns that can be sacrificed against the blocking pawn
-            b2 = attack_span_mask(winnerSide, blockSq) & candidates & ~(1ULL << s);
+            b2 = pawn_attack_span(winnerSide, blockSq) & candidates & ~(1ULL << s);
 
             while (b2) // This while-loop could be replaced with LSB/MSB (depending on color)
             {
index e1952b60260d8a8a55666450f923f4d41a8d73ce..ea5f9287c2940ef820efc93498333cdfed45b6fb 100644 (file)
@@ -134,7 +134,7 @@ namespace {
         // be backward. If there are friendly pawns behind on adjacent files
         // or if can capture an enemy pawn it cannot be backward either.
         if (   !(passed | isolated | chain)
-            && !(ourPawns & attack_span_mask(Them, s))
+            && !(ourPawns & pawn_attack_span(Them, s))
             && !(pos.attacks_from<PAWN>(s, Us) & theirPawns))
         {
             // We now know that there are no friendly pawns beside or behind this
@@ -153,15 +153,15 @@ namespace {
             backward = (b | shift_bb<Up>(b)) & theirPawns;
         }
 
-        assert(opposed | passed | (attack_span_mask(Us, s) & theirPawns));
+        assert(opposed | passed | (pawn_attack_span(Us, s) & theirPawns));
 
         // A not passed pawn is a candidate to become passed if it is free to
         // advance and if the number of friendly pawns beside or behind this
         // pawn on adjacent files is higher or equal than the number of
         // enemy pawns in the forward direction on the adjacent files.
         candidate =   !(opposed | passed | backward | isolated)
-                   && (b = attack_span_mask(Them, s + pawn_push(Us)) & ourPawns) != 0
-                   &&  popcount<Max15>(b) >= popcount<Max15>(attack_span_mask(Us, s) & theirPawns);
+                   && (b = pawn_attack_span(Them, s + pawn_push(Us)) & ourPawns) != 0
+                   &&  popcount<Max15>(b) >= popcount<Max15>(pawn_attack_span(Us, s) & theirPawns);
 
         // Passed pawns will be properly scored in evaluation because we need
         // full attack info to evaluate passed pawns. Only the frontmost passed