]> git.sesse.net Git - stockfish/commitdiff
Remove some useless casts
authorMarco Costalba <mcostalba@gmail.com>
Sun, 27 Apr 2014 09:40:44 +0000 (11:40 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 27 Apr 2014 09:44:16 +0000 (11:44 +0200)
No functional change.

src/evaluate.cpp
src/notation.cpp
src/position.cpp
src/search.cpp
src/timeman.cpp
src/timeman.h

index 0fef0258b1de329d7d6bede6a11d933cb6ba6f69..e1a000c6323d081a2458285083c2c38a4b0910b8 100644 (file)
@@ -915,12 +915,12 @@ namespace Eval {
     Weights[KingDangerUs]   = weight_option("Cowardice", "Cowardice", WeightsInternal[KingDangerUs]);
     Weights[KingDangerThem] = weight_option("Aggressiveness", "Aggressiveness", WeightsInternal[KingDangerThem]);
 
     Weights[KingDangerUs]   = weight_option("Cowardice", "Cowardice", WeightsInternal[KingDangerUs]);
     Weights[KingDangerThem] = weight_option("Aggressiveness", "Aggressiveness", WeightsInternal[KingDangerThem]);
 
-    const int MaxSlope = 30;
-    const int Peak = 1280;
+    const double MaxSlope = 30;
+    const double Peak = 1280;
 
     for (int t = 0, i = 1; i < 100; ++i)
     {
 
     for (int t = 0, i = 1; i < 100; ++i)
     {
-        t = std::min(Peak, std::min(int(0.4 * i * i), t + MaxSlope));
+        t = std::min(Peak, std::min(0.4 * i * i, t + MaxSlope));
 
         KingDanger[1][i] = apply_weight(make_score(t, 0), Weights[KingDangerUs]);
         KingDanger[0][i] = apply_weight(make_score(t, 0), Weights[KingDangerThem]);
 
         KingDanger[1][i] = apply_weight(make_score(t, 0), Weights[KingDangerUs]);
         KingDanger[0][i] = apply_weight(make_score(t, 0), Weights[KingDangerThem]);
index 944cca19ea205064727c2617e4f698365029f764..cace78b953fb083a101f80fa1b0028d1b8e8892f 100644 (file)
@@ -43,7 +43,7 @@ string score_to_uci(Value v, Value alpha, Value beta) {
   stringstream ss;
 
   if (abs(v) < VALUE_MATE_IN_MAX_PLY)
   stringstream ss;
 
   if (abs(v) < VALUE_MATE_IN_MAX_PLY)
-      ss << "cp " << v * 100 / int(PawnValueEg);
+      ss << "cp " << v * 100 / PawnValueEg;
   else
       ss << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2;
 
   else
       ss << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2;
 
index 6b05c24b2a434d3ef1f41b454af877883dc0b765..982352c51b74bbde4f91d0f4f34f8a84e78c33e8 100644 (file)
@@ -297,7 +297,7 @@ void Position::set(const string& fenStr, bool isChess960, Thread* th) {
 
   // Convert from fullmove starting from 1 to ply starting from 0,
   // handle also common incorrect FEN with fullmove = 0.
 
   // Convert from fullmove starting from 1 to ply starting from 0,
   // handle also common incorrect FEN with fullmove = 0.
-  gamePly = std::max(2 * (gamePly - 1), 0) + int(sideToMove == BLACK);
+  gamePly = std::max(2 * (gamePly - 1), 0) + (sideToMove == BLACK);
 
   chess960 = isChess960;
   thisThread = th;
 
   chess960 = isChess960;
   thisThread = th;
@@ -424,7 +424,7 @@ const string Position::fen() const {
       ss << '-';
 
   ss << (ep_square() == SQ_NONE ? " - " : " " + to_string(ep_square()) + " ")
       ss << '-';
 
   ss << (ep_square() == SQ_NONE ? " - " : " " + to_string(ep_square()) + " ")
-     << st->rule50 << " " << 1 + (gamePly - int(sideToMove == BLACK)) / 2;
+     << st->rule50 << " " << 1 + (gamePly - (sideToMove == BLACK)) / 2;
 
   return ss.str();
 }
 
   return ss.str();
 }
index 2f7ed7be09127428341fc7cb0564bb1ff67ba8f6..d0929d5dfb3f34a019979a2825c8014d56b6a6a5 100644 (file)
@@ -146,8 +146,8 @@ void Search::init() {
   // Init futility move count array
   for (d = 0; d < 32; ++d)
   {
   // Init futility move count array
   for (d = 0; d < 32; ++d)
   {
-      FutilityMoveCounts[0][d] = int(2.4 + 0.222 * pow(d + 0.00, 1.8));
-      FutilityMoveCounts[1][d] = int(3.0 + 0.300 * pow(d + 0.98, 1.8));
+      FutilityMoveCounts[0][d] = 2.4 + 0.222 * pow(d + 0.00, 1.8);
+      FutilityMoveCounts[1][d] = 3.0 + 0.300 * pow(d + 0.98, 1.8);
   }
 }
 
   }
 }
 
index 2092b7299ed1c3b78ac9b53178bf5e61e7672d8d..34858f3a0459a86fc380eb8e047895c7eaa950d6 100644 (file)
@@ -63,7 +63,7 @@ namespace {
     double ratio1 = (TMaxRatio * thisMoveImportance) / (TMaxRatio * thisMoveImportance + otherMovesImportance);
     double ratio2 = (thisMoveImportance + TStealRatio * otherMovesImportance) / (thisMoveImportance + otherMovesImportance);
 
     double ratio1 = (TMaxRatio * thisMoveImportance) / (TMaxRatio * thisMoveImportance + otherMovesImportance);
     double ratio2 = (thisMoveImportance + TStealRatio * otherMovesImportance) / (thisMoveImportance + otherMovesImportance);
 
-    return int(floor(myTime * std::min(ratio1, ratio2)));
+    return floor(myTime * std::min(ratio1, ratio2));
   }
 
 } // namespace
   }
 
 } // namespace
index a15551af567461a43e55d202122f936513be8a8d..83da9c5ecdc4820be3c5a5136d61922cbe0ba582 100644 (file)
@@ -27,7 +27,7 @@ class TimeManager {
 public:
   void init(const Search::LimitsType& limits, int currentPly, Color us);
   void pv_instability(double bestMoveChanges) { unstablePvFactor = 1 + bestMoveChanges; }
 public:
   void init(const Search::LimitsType& limits, int currentPly, Color us);
   void pv_instability(double bestMoveChanges) { unstablePvFactor = 1 + bestMoveChanges; }
-  int available_time() const { return int(optimumSearchTime * unstablePvFactor * 0.71); }
+  int available_time() const { return optimumSearchTime * unstablePvFactor * 0.71; }
   int maximum_time() const { return maximumSearchTime; }
 
 private:
   int maximum_time() const { return maximumSearchTime; }
 
 private: