From 86c20416c85ac93ab982dda404fc268a92636fa6 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 27 Apr 2014 11:40:44 +0200 Subject: [PATCH] Remove some useless casts No functional change. --- src/evaluate.cpp | 6 +++--- src/notation.cpp | 2 +- src/position.cpp | 4 ++-- src/search.cpp | 4 ++-- src/timeman.cpp | 2 +- src/timeman.h | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 0fef0258..e1a000c6 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -915,12 +915,12 @@ namespace Eval { 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) { - 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]); diff --git a/src/notation.cpp b/src/notation.cpp index 944cca19..cace78b9 100644 --- a/src/notation.cpp +++ b/src/notation.cpp @@ -43,7 +43,7 @@ string score_to_uci(Value v, Value alpha, Value beta) { 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; diff --git a/src/position.cpp b/src/position.cpp index 6b05c24b..982352c5 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -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. - gamePly = std::max(2 * (gamePly - 1), 0) + int(sideToMove == BLACK); + gamePly = std::max(2 * (gamePly - 1), 0) + (sideToMove == BLACK); chess960 = isChess960; thisThread = th; @@ -424,7 +424,7 @@ const string Position::fen() const { 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(); } diff --git a/src/search.cpp b/src/search.cpp index 2f7ed7be..d0929d5d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -146,8 +146,8 @@ void Search::init() { // 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); } } diff --git a/src/timeman.cpp b/src/timeman.cpp index 2092b729..34858f3a 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -63,7 +63,7 @@ namespace { 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 diff --git a/src/timeman.h b/src/timeman.h index a15551af..83da9c5e 100644 --- a/src/timeman.h +++ b/src/timeman.h @@ -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; } - 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: -- 2.39.2