]> git.sesse.net Git - stockfish/commitdiff
Fix MSVC 2012 64bits warnings
authorMarco Costalba <mcostalba@gmail.com>
Fri, 14 Sep 2012 07:42:59 +0000 (09:42 +0200)
committerMarco Costalba <mcostalba@gmail.com>
Fri, 14 Sep 2012 07:57:13 +0000 (09:57 +0200)
Reported by Rein.

No functional change.

src/benchmark.cpp
src/notation.cpp
src/notation.h
src/search.cpp

index f59ded730d6f3f6f0751a568a7f55e476927994e..f63cb8e9b7f6005a7e0aa7bdea2c256d10651e0b 100644 (file)
@@ -111,7 +111,7 @@ void benchmark(const Position& current, istream& is) {
 
   int64_t nodes = 0;
   Search::StateStackPtr st;
-  Time::point t = Time::now();
+  Time::point elapsed = Time::now();
 
   for (size_t i = 0; i < fens.size(); i++)
   {
@@ -133,10 +133,10 @@ void benchmark(const Position& current, istream& is) {
       }
   }
 
-  int e = Time::now() - t + 1; // Assure positive to avoid a 'divide by zero'
+  elapsed = Time::now() - elapsed + 1; // Assure positive to avoid a 'divide by zero'
 
   cerr << "\n==========================="
-       << "\nTotal time (ms) : " << e
+       << "\nTotal time (ms) : " << elapsed
        << "\nNodes searched  : " << nodes
-       << "\nNodes/second    : " << 1000 * nodes / e << endl;
+       << "\nNodes/second    : " << 1000 * nodes / elapsed << endl;
 }
index c4d1c439be38f0f635fa70a4f4a130352e32246a..fb65f6f5fa9f2bbb42275f2d4c55a9ee203bf4e6 100644 (file)
@@ -186,14 +186,14 @@ const string move_to_san(Position& pos, Move m) {
 /// appended to the search log file. It uses the two helpers below to pretty
 /// format time and score respectively.
 
-static string time_to_string(int millisecs) {
+static string time_to_string(int64_t msecs) {
 
   const int MSecMinute = 1000 * 60;
   const int MSecHour   = 1000 * 60 * 60;
 
-  int hours = millisecs / MSecHour;
-  int minutes =  (millisecs % MSecHour) / MSecMinute;
-  int seconds = ((millisecs % MSecHour) % MSecMinute) / 1000;
+  int64_t hours   =   msecs / MSecHour;
+  int64_t minutes =  (msecs % MSecHour) / MSecMinute;
+  int64_t seconds = ((msecs % MSecHour) % MSecMinute) / 1000;
 
   stringstream s;
 
@@ -221,7 +221,7 @@ static string score_to_string(Value v) {
   return s.str();
 }
 
-string pretty_pv(Position& pos, int depth, Value value, int time, Move pv[]) {
+string pretty_pv(Position& pos, int depth, Value value, int64_t msecs, Move pv[]) {
 
   const int64_t K = 1000;
   const int64_t M = 1000000;
@@ -234,7 +234,7 @@ string pretty_pv(Position& pos, int depth, Value value, int time, Move pv[]) {
 
   s << setw(2) << depth
     << setw(8) << score_to_string(value)
-    << setw(8) << time_to_string(time);
+    << setw(8) << time_to_string(msecs);
 
   if (pos.nodes_searched() < M)
       s << setw(8) << pos.nodes_searched() / 1 << "  ";
index 5c23a2ce3a49da5359e57a2b49b8969791772ff6..0c5f2fed0ab9243011c381a547884c80e4bf110a 100644 (file)
@@ -30,6 +30,6 @@ std::string score_to_uci(Value v, Value alpha = -VALUE_INFINITE, Value beta = VA
 Move move_from_uci(const Position& pos, std::string& str);
 const std::string move_to_uci(Move m, bool chess960);
 const std::string move_to_san(Position& pos, Move m);
-std::string pretty_pv(Position& pos, int depth, Value score, int time, Move pv[]);
+std::string pretty_pv(Position& pos, int depth, Value score, int64_t msecs, Move pv[]);
 
 #endif // !defined(NOTATION_H_INCLUDED)
index 1cf9428ef43e47c5610e611350386877d2257edf..219c10aad7eda8a840bb8338e9d5dc3110a9dc53 100644 (file)
@@ -290,11 +290,11 @@ void Search::think() {
 
   if (Options["Use Search Log"])
   {
-      int e = Time::now() - SearchTime;
+      Time::point elapsed = Time::now() - SearchTime + 1;
 
       Log log(Options["Search Log Filename"]);
       log << "Nodes: "          << pos.nodes_searched()
-          << "\nNodes/second: " << (e > 0 ? pos.nodes_searched() * 1000 / e : 0)
+          << "\nNodes/second: " << pos.nodes_searched() * 1000 / elapsed
           << "\nBest move: "    << move_to_san(pos, RootMoves[0].pv[0]);
 
       StateInfo st;
@@ -1536,7 +1536,7 @@ split_point_start: // At split points actual search starts from here
   string uci_pv(const Position& pos, int depth, Value alpha, Value beta) {
 
     std::stringstream s;
-    int t = Time::now() - SearchTime;
+    Time::point elaspsed = Time::now() - SearchTime + 1;
     int selDepth = 0;
 
     for (size_t i = 0; i < Threads.size(); i++)
@@ -1557,12 +1557,12 @@ split_point_start: // At split points actual search starts from here
             s << "\n";
 
         s << "info depth " << d
-          << " seldepth " << selDepth
-          << " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
-          << " nodes " << pos.nodes_searched()
-          << " nps " << (t > 0 ? pos.nodes_searched() * 1000 / t : 0)
-          << " time " << t
-          << " multipv " << i + 1
+          << " seldepth "  << selDepth
+          << " score "     << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
+          << " nodes "     << pos.nodes_searched()
+          << " nps "       << pos.nodes_searched() * 1000 / elaspsed
+          << " time "      << elaspsed
+          << " multipv "   << i + 1
           << " pv";
 
         for (size_t j = 0; RootMoves[i].pv[j] != MOVE_NONE; j++)
@@ -1760,15 +1760,15 @@ void check_time() {
   if (Limits.ponder)
       return;
 
-  int e = Time::now() - SearchTime;
+  Time::point elapsed = Time::now() - SearchTime;
   bool stillAtFirstMove =    Signals.firstRootMove
                          && !Signals.failedLowAtRoot
-                         &&  e > TimeMgr.available_time();
+                         &&  elapsed > TimeMgr.available_time();
 
-  bool noMoreTime =   e > TimeMgr.maximum_time() - 2 * TimerResolution
+  bool noMoreTime =   elapsed > TimeMgr.maximum_time() - 2 * TimerResolution
                    || stillAtFirstMove;
 
   if (   (Limits.use_time_management() && noMoreTime)
-      || (Limits.movetime && e >= Limits.movetime))
+      || (Limits.movetime && elapsed >= Limits.movetime))
       Signals.stop = true;
 }