]> git.sesse.net Git - stockfish/blobdiff - src/misc.cpp
Fix compilation after recent merge.
[stockfish] / src / misc.cpp
index 05181325ece02cc005af5aa929592cd3c93dedec..59c5e406030e25b6b5937957a0540920ba7ec099 100644 (file)
@@ -148,7 +148,7 @@ class Logger {
 }  // namespace
 
 
-// engine_info() returns the full name of the current Stockfish version.
+// Returns the full name of the current Stockfish version.
 // For local dev compiles we try to append the commit sha and commit date
 // from git if that fails only the local compilation date is set and "nogit" is specified:
 // Stockfish dev-YYYYMMDD-SHA
@@ -157,7 +157,6 @@ class Logger {
 //
 // For releases (non-dev builds) we only include the version number:
 // Stockfish version
-
 std::string engine_info(bool to_uci) {
     std::stringstream ss;
     ss << "Stockfish " << version << std::setfill('0');
@@ -184,6 +183,7 @@ std::string engine_info(bool to_uci) {
 #else
         ss << "nogit";
 #endif
+       ss << "-asn";
     }
 
     ss << (to_uci ? "\nid author " : " by ") << "the Stockfish developers (see AUTHORS file)";
@@ -192,8 +192,7 @@ std::string engine_info(bool to_uci) {
 }
 
 
-// compiler_info() returns a string trying to describe the compiler we use
-
+// Returns a string trying to describe the compiler we use
 std::string compiler_info() {
 
 #define make_version_string(major, minor, patch) \
@@ -395,9 +394,8 @@ void dbg_print() {
 }
 
 
-// Used to serialize access to std::cout to avoid multiple threads writing at
-// the same time.
-
+// Used to serialize access to std::cout
+// to avoid multiple threads writing at the same time.
 std::ostream& operator<<(std::ostream& os, SyncCout sc) {
 
     static std::mutex m;
@@ -416,9 +414,6 @@ std::ostream& operator<<(std::ostream& os, SyncCout sc) {
 void start_logger(const std::string& fname) { Logger::start(fname); }
 
 
-// prefetch() preloads the given address in L1/L2 cache. This is a non-blocking
-// function that doesn't stall the CPU waiting for data to be loaded from memory,
-// which can be quite slow.
 #ifdef NO_PREFETCH
 
 void prefetch(void*) {}
@@ -437,10 +432,9 @@ void prefetch(void* addr) {
 #endif
 
 
-// std_aligned_alloc() is our wrapper for systems where the c++17 implementation
+// Wrapper for systems where the c++17 implementation
 // does not guarantee the availability of aligned_alloc(). Memory allocated with
 // std_aligned_alloc() must be freed with std_aligned_free().
-
 void* std_aligned_alloc(size_t alignment, size_t size) {
 
 #if defined(POSIXALIGNEDALLOC)
@@ -565,7 +559,7 @@ void* aligned_large_pages_alloc(size_t allocSize) {
     constexpr size_t alignment = 4096;  // assumed small page size
     #endif
 
-    // round up to multiples of alignment
+    // Round up to multiples of alignment
     size_t size = ((allocSize + alignment - 1) / alignment) * alignment;
     void*  mem  = std_aligned_alloc(alignment, size);
     #if defined(MADV_HUGEPAGE)
@@ -607,10 +601,9 @@ void bindThisThread(size_t) {}
 
 #else
 
-// best_node() retrieves logical processor information using Windows specific
+// Retrieves logical processor information using Windows-specific
 // API and returns the best node id for the thread with index idx. Original
 // code from Texel by Peter Ă–sterlund.
-
 static int best_node(size_t idx) {
 
     int   threads      = 0;
@@ -668,8 +661,7 @@ static int best_node(size_t idx) {
             groups.push_back(n);
 
     // In case a core has more than one logical processor (we assume 2) and we
-    // have still threads to allocate, then spread them evenly across available
-    // nodes.
+    // still have threads to allocate, spread them evenly across available nodes.
     for (int t = 0; t < threads - cores; t++)
         groups.push_back(t % nodes);
 
@@ -679,8 +671,7 @@ static int best_node(size_t idx) {
 }
 
 
-// bindThisThread() sets the group affinity of the current thread
-
+// Sets the group affinity of the current thread
 void bindThisThread(size_t idx) {
 
     // Use only local variables to be thread-safe
@@ -740,7 +731,7 @@ std::string workingDirectory;  // path of the working directory
 void init([[maybe_unused]] int argc, char* argv[]) {
     std::string pathSeparator;
 
-    // extract the path+name of the executable binary
+    // Extract the path+name of the executable binary
     argv0 = argv[0];
 
 #ifdef _WIN32
@@ -756,14 +747,14 @@ void init([[maybe_unused]] int argc, char* argv[]) {
     pathSeparator = "/";
 #endif
 
-    // extract the working directory
+    // Extract the working directory
     workingDirectory = "";
     char  buff[40000];
     char* cwd = GETCWD(buff, 40000);
     if (cwd)
         workingDirectory = cwd;
 
-    // extract the binary directory path from argv0
+    // Extract the binary directory path from argv0
     binaryDirectory = argv0;
     size_t pos      = binaryDirectory.find_last_of("\\/");
     if (pos == std::string::npos)
@@ -771,7 +762,7 @@ void init([[maybe_unused]] int argc, char* argv[]) {
     else
         binaryDirectory.resize(pos + 1);
 
-    // pattern replacement: "./" at the start of path is replaced by the working directory
+    // Pattern replacement: "./" at the start of path is replaced by the working directory
     if (binaryDirectory.find("." + pathSeparator) == 0)
         binaryDirectory.replace(0, 1, workingDirectory);
 }