Permalink
Browse files

Fix MSVC 2012 64bits warnings

Reported by Rein.

No functional change.
  • Loading branch information...
mcostalba committed Sep 14, 2012
1 parent e0bd0f2 commit afcee1e8a4aadb9c86e17c71d5943d03268ca6d6
Showing with 24 additions and 24 deletions.
  1. +4 −4 src/benchmark.cpp
  2. +6 −6 src/notation.cpp
  3. +1 −1 src/notation.h
  4. +13 −13 src/search.cpp
View
@@ -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;
}
View
@@ -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 << " ";
View
@@ -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)
View
@@ -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 @@ namespace {
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 @@ namespace {
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;
}

0 comments on commit afcee1e

Please sign in to comment.