1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Fix MSVC 2012 64bits warnings

Reported by Rein.

No functional change.
This commit is contained in:
Marco Costalba 2012-09-14 09:42:59 +02:00
parent e0bd0f250b
commit afcee1e8a4
4 changed files with 24 additions and 24 deletions

View file

@ -111,7 +111,7 @@ void benchmark(const Position& current, istream& is) {
int64_t nodes = 0; int64_t nodes = 0;
Search::StateStackPtr st; Search::StateStackPtr st;
Time::point t = Time::now(); Time::point elapsed = Time::now();
for (size_t i = 0; i < fens.size(); i++) 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===========================" cerr << "\n==========================="
<< "\nTotal time (ms) : " << e << "\nTotal time (ms) : " << elapsed
<< "\nNodes searched : " << nodes << "\nNodes searched : " << nodes
<< "\nNodes/second : " << 1000 * nodes / e << endl; << "\nNodes/second : " << 1000 * nodes / elapsed << endl;
} }

View 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 /// appended to the search log file. It uses the two helpers below to pretty
/// format time and score respectively. /// 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 MSecMinute = 1000 * 60;
const int MSecHour = 1000 * 60 * 60; const int MSecHour = 1000 * 60 * 60;
int hours = millisecs / MSecHour; int64_t hours = msecs / MSecHour;
int minutes = (millisecs % MSecHour) / MSecMinute; int64_t minutes = (msecs % MSecHour) / MSecMinute;
int seconds = ((millisecs % MSecHour) % MSecMinute) / 1000; int64_t seconds = ((msecs % MSecHour) % MSecMinute) / 1000;
stringstream s; stringstream s;
@ -221,7 +221,7 @@ static string score_to_string(Value v) {
return s.str(); 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 K = 1000;
const int64_t M = 1000000; 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 s << setw(2) << depth
<< setw(8) << score_to_string(value) << setw(8) << score_to_string(value)
<< setw(8) << time_to_string(time); << setw(8) << time_to_string(msecs);
if (pos.nodes_searched() < M) if (pos.nodes_searched() < M)
s << setw(8) << pos.nodes_searched() / 1 << " "; s << setw(8) << pos.nodes_searched() / 1 << " ";

View 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); 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_uci(Move m, bool chess960);
const std::string move_to_san(Position& pos, Move m); 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) #endif // !defined(NOTATION_H_INCLUDED)

View file

@ -290,11 +290,11 @@ void Search::think() {
if (Options["Use Search Log"]) if (Options["Use Search Log"])
{ {
int e = Time::now() - SearchTime; Time::point elapsed = Time::now() - SearchTime + 1;
Log log(Options["Search Log Filename"]); Log log(Options["Search Log Filename"]);
log << "Nodes: " << pos.nodes_searched() 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]); << "\nBest move: " << move_to_san(pos, RootMoves[0].pv[0]);
StateInfo st; 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) { string uci_pv(const Position& pos, int depth, Value alpha, Value beta) {
std::stringstream s; std::stringstream s;
int t = Time::now() - SearchTime; Time::point elaspsed = Time::now() - SearchTime + 1;
int selDepth = 0; int selDepth = 0;
for (size_t i = 0; i < Threads.size(); i++) for (size_t i = 0; i < Threads.size(); i++)
@ -1560,8 +1560,8 @@ split_point_start: // At split points actual search starts from here
<< " seldepth " << selDepth << " seldepth " << selDepth
<< " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v)) << " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
<< " nodes " << pos.nodes_searched() << " nodes " << pos.nodes_searched()
<< " nps " << (t > 0 ? pos.nodes_searched() * 1000 / t : 0) << " nps " << pos.nodes_searched() * 1000 / elaspsed
<< " time " << t << " time " << elaspsed
<< " multipv " << i + 1 << " multipv " << i + 1
<< " pv"; << " pv";
@ -1760,15 +1760,15 @@ void check_time() {
if (Limits.ponder) if (Limits.ponder)
return; return;
int e = Time::now() - SearchTime; Time::point elapsed = Time::now() - SearchTime;
bool stillAtFirstMove = Signals.firstRootMove bool stillAtFirstMove = Signals.firstRootMove
&& !Signals.failedLowAtRoot && !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; || stillAtFirstMove;
if ( (Limits.use_time_management() && noMoreTime) if ( (Limits.use_time_management() && noMoreTime)
|| (Limits.movetime && e >= Limits.movetime)) || (Limits.movetime && elapsed >= Limits.movetime))
Signals.stop = true; Signals.stop = true;
} }