]> git.sesse.net Git - stockfish/commitdiff
Retire useless piece_value_midgame() overloads
authorMarco Costalba <mcostalba@gmail.com>
Thu, 19 Aug 2010 16:00:36 +0000 (17:00 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Thu, 19 Aug 2010 17:22:46 +0000 (18:22 +0100)
Directly access the table in the few call places.

No functional change.

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

index 11684d763124ed1872f7b8746123528321e846c8..b7272645a3914e896ab7a0ede8311bd04ed2307b 100644 (file)
@@ -889,7 +889,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
           st->value += pst(us, promotion, to);
 
           // Update material
-          st->npMaterial[us] += piece_value_midgame(promotion);
+          st->npMaterial[us] += PieceValueMidgame[promotion];
       }
   }
 
@@ -962,7 +962,7 @@ void Position::do_capture_move(Key& key, PieceType capture, Color them, Square t
         st->pawnKey ^= zobrist[them][PAWN][capsq];
     }
     else
-        st->npMaterial[them] -= piece_value_midgame(capture);
+        st->npMaterial[them] -= PieceValueMidgame[capture];
 
     // Remove captured piece
     clear_bit(&(byColorBB[them]), capsq);
@@ -1694,8 +1694,9 @@ Value Position::compute_non_pawn_material(Color c) const {
       while (b)
       {
           assert(piece_on(first_1(b)) == piece_of_color_and_type(c, pt));
+
           pop_1st_bit(&b);
-          result += piece_value_midgame(pt);
+          result += PieceValueMidgame[pt];
       }
   }
   return result;
index 6d7ea0ef30bcd990b98f9d976137d091575f04cb..b006cff248fef882e4c4901ced0911b722009bcf 100644 (file)
@@ -377,11 +377,11 @@ inline bool Position::square_is_occupied(Square s) const {
 }
 
 inline Value Position::midgame_value_of_piece_on(Square s) const {
-  return piece_value_midgame(piece_on(s));
+  return PieceValueMidgame[piece_on(s)];
 }
 
 inline Value Position::endgame_value_of_piece_on(Square s) const {
-  return piece_value_endgame(piece_on(s));
+  return PieceValueEndgame[piece_on(s)];
 }
 
 inline Color Position::side_to_move() const {
index 345526b625eaf3e3118d37f0e06e54476f6fd17c..f4db35e5d2a9583c517f4624ddf503e22918ecc1 100644 (file)
@@ -163,28 +163,12 @@ inline Value value_mated_in(int ply) {
   return -VALUE_MATE + ply;
 }
 
-inline bool is_upper_bound(ValueType vt) {
-  return (int(vt) & int(VALUE_TYPE_UPPER)) != 0;
+inline int is_upper_bound(ValueType vt) {
+  return vt & VALUE_TYPE_UPPER;
 }
 
-inline bool is_lower_bound(ValueType vt) {
-  return (int(vt) & int(VALUE_TYPE_LOWER)) != 0;
-}
-
-inline Value piece_value_midgame(PieceType pt) {
-  return PieceValueMidgame[pt];
-}
-
-inline Value piece_value_endgame(PieceType pt) {
-  return PieceValueEndgame[pt];
-}
-
-inline Value piece_value_midgame(Piece p) {
-  return PieceValueMidgame[p];
-}
-
-inline Value piece_value_endgame(Piece p) {
-  return PieceValueEndgame[p];
+inline int is_lower_bound(ValueType vt) {
+  return vt & VALUE_TYPE_LOWER;
 }
 
 #endif // !defined(VALUE_H_INCLUDED)