]> git.sesse.net Git - stockfish/blobdiff - src/pawns.cpp
Retire useless piece_value_midgame() overloads
[stockfish] / src / pawns.cpp
index 34c25959ab957e300a4857056f4ca5f23bc4efa2..cec9aba142af22fcf96edf82879ef8da7f190fa8 100644 (file)
@@ -185,7 +185,7 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
   Rank r;
   int bonus;
   bool passed, isolated, doubled, opposed, chain, backward, candidate;
-  Score value = make_score(0, 0);
+  Score value = SCORE_ZERO;
   const Square* ptr = pos.piece_list_begin(Us, PAWN);
 
   // Initialize pawn storm scores by giving bonuses for open files
@@ -214,7 +214,7 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
       pi->qsStormValue[Us] += QStormTable[relative_square(Us, s)] + bonus;
 
       // Our rank plus previous one. Used for chain detection.
-      b = rank_bb(r) | rank_bb(r + (Us == WHITE ? -1 : 1));
+      b = rank_bb(r) | rank_bb(Us == WHITE ? r - Rank(1) : r + Rank(1));
 
       // Passed, isolated, doubled or member of a pawn
       // chain (but not the backward one) ?
@@ -226,15 +226,15 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
 
       // Test for backward pawn
       //
+      backward = false;
+
       // If the pawn is passed, isolated, or member of a pawn chain
       // it cannot be backward. If can capture an enemy pawn or if
       // there are friendly pawns behind on neighboring files it cannot
       // be backward either.
-      if (   (passed | isolated | chain)
-          || (ourPawns & attack_span_mask(opposite_color(Us), s))
-          || (pos.attacks_from<PAWN>(s, Us) & theirPawns))
-          backward = false;
-      else
+      if (   !(passed | isolated | chain)
+          && !(ourPawns & attack_span_mask(opposite_color(Us), s))
+          && !(pos.attacks_from<PAWN>(s, Us) & theirPawns))
       {
           // We now know that there are no friendly pawns beside or behind this
           // pawn on neighboring files. We now check whether the pawn is