diff --git a/library/src/quick_tricks.cpp b/library/src/quick_tricks.cpp index ac1417b1..d1fade94 100644 --- a/library/src/quick_tricks.cpp +++ b/library/src/quick_tricks.cpp @@ -1116,8 +1116,6 @@ int QuickTricksPartnerHandNT( return qt; if ((countOwn <= 2) && (countLho <= 2) && (countRho <= 2)) { - // TODO: Is the fix to qt correct? - // qtricks += countPart - 2; qt += countPart - 2; if (qt >= cutoff) return qt; diff --git a/library/src/solver_context/solver_context.cpp b/library/src/solver_context/solver_context.cpp index fd85df64..34bd6cc9 100644 --- a/library/src/solver_context/solver_context.cpp +++ b/library/src/solver_context/solver_context.cpp @@ -13,7 +13,7 @@ // SolverContext so callers can create a context at the top of the stack // and pass it down without a separate per-thread lookup. SolverContext::SolverContext(SolverConfig cfg) - : thr_(nullptr), cfg_(cfg) //TODO: remove thr_(nullptr) which is redundant + : cfg_(cfg) { // Create an owned ThreadData instance and keep it in thr_. thr_ = std::make_shared(); @@ -234,7 +234,8 @@ auto SolverContext::reset_best_moves_lite() const -> void auto ThreadMemoryUsed() -> double { - // TODO: Only needed because SolverIF wants to set it. Avoid? + // Fixed per-thread lookup-table memory (RelRanksType) included in memUsed + // reporting; legacy SolverIF uses the same accounting. double memUsed = 8192 * sizeof(RelRanksType) / static_cast(1024.); diff --git a/library/src/system/system.cpp b/library/src/system/system.cpp index b6965cf3..ac8710c5 100644 --- a/library/src/system/system.cpp +++ b/library/src/system/system.cpp @@ -8,6 +8,7 @@ */ #include +#include #if defined(__linux__) || defined(__APPLE__) || defined(__unix__) #include @@ -388,18 +389,19 @@ string System::get_constructor(int& cons) const int System::get_cores() const { + const unsigned int hw = std::thread::hardware_concurrency(); + if (hw > 0) + return static_cast(hw); + int cores = 0; #if defined(_WIN32) || defined(__CYGWIN__) SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); cores = static_cast(sysinfo.dwNumberOfProcessors); #elif defined(__APPLE__) || defined(__linux__) - cores = sysconf(_SC_NPROCESSORS_ONLN); + cores = static_cast(sysconf(_SC_NPROCESSORS_ONLN)); #endif - // TODO Think about thread::hardware_concurrency(). - // This should be standard in C++11. - return cores; }