X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fmisc.cpp;h=0920f7f08838b132f7413ee41c2a4229e0c80966;hp=2a476504995959074e27b509d4688ec98ecab25b;hb=ac7339877b3e083b5dd93f34ec79779d43f784ae;hpb=e3b23eb81887b158b8cebb6d097ad621166cdf8f diff --git a/src/misc.cpp b/src/misc.cpp index 2a476504..0920f7f0 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -29,6 +29,7 @@ #else #define _CRT_SECURE_NO_DEPRECATE +#define NOMINMAX // disable macros min() and max() #include #include @@ -43,6 +44,7 @@ #include #include #include +#include #include "bitcount.h" #include "misc.h" @@ -54,7 +56,7 @@ using namespace std; /// current date (in the format YYMMDD) is used as a version number. static const string AppName = "Stockfish"; -static const string EngineVersion = "2.1.1"; +static const string EngineVersion = ""; static const string AppTag = ""; @@ -103,14 +105,14 @@ static uint64_t dbg_mean_cnt1; void dbg_print_hit_rate() { if (dbg_hit_cnt0) - cout << "Total " << dbg_hit_cnt0 << " Hit " << dbg_hit_cnt1 + cerr << "Total " << dbg_hit_cnt0 << " Hit " << dbg_hit_cnt1 << " hit rate (%) " << 100 * dbg_hit_cnt1 / dbg_hit_cnt0 << endl; } void dbg_print_mean() { if (dbg_mean_cnt0) - cout << "Total " << dbg_mean_cnt0 << " Mean " + cerr << "Total " << dbg_mean_cnt0 << " Mean " << (float)dbg_mean_cnt1 / dbg_mean_cnt0 << endl; } @@ -155,16 +157,16 @@ int cpu_count() { #if defined(_MSC_VER) SYSTEM_INFO s; GetSystemInfo(&s); - return Min(s.dwNumberOfProcessors, MAX_THREADS); + return std::min(int(s.dwNumberOfProcessors), MAX_THREADS); #else # if defined(_SC_NPROCESSORS_ONLN) - return Min(sysconf(_SC_NPROCESSORS_ONLN), MAX_THREADS); + return std::min((int)sysconf(_SC_NPROCESSORS_ONLN), MAX_THREADS); # elif defined(__hpux) struct pst_dynamic psd; if (pstat_getdynamic(&psd, sizeof(psd), (size_t)1, 0) == -1) return 1; - return Min(psd.psd_proc_cnt, MAX_THREADS); + return std::min((int)psd.psd_proc_cnt, MAX_THREADS); # else return 1; # endif @@ -232,7 +234,7 @@ int input_available() { GetNumberOfConsoleInputEvents(inh, &nchars); // Read data from console without removing it from the buffer - if (nchars <= 0 || !PeekConsoleInput(inh, rec, Min(nchars, 256), &recCnt)) + if (nchars <= 0 || !PeekConsoleInput(inh, rec, std::min(int(nchars), 256), &recCnt)) return 0; // Search for at least one keyboard event