]> git.sesse.net Git - stockfish/blobdiff - src/misc.h
Fix compilation after recent merge.
[stockfish] / src / misc.h
index 3cd3315a8ed1ba79bdcff5d5984928f99368ec93..91fdb72f1b1a308b389106293705897bd5016728 100644 (file)
@@ -33,13 +33,19 @@ namespace Stockfish {
 
 std::string engine_info(bool to_uci = false);
 std::string compiler_info();
-void        prefetch(void* addr);
-void        start_logger(const std::string& fname);
-void*       std_aligned_alloc(size_t alignment, size_t size);
-void        std_aligned_free(void* ptr);
-void*       aligned_large_pages_alloc(
-        size_t size);                      // memory aligned by page size, min alignment: 4096 bytes
-void aligned_large_pages_free(void* mem);  // nop if mem == nullptr
+
+// 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.
+void prefetch(void* addr);
+
+void  start_logger(const std::string& fname);
+void* std_aligned_alloc(size_t alignment, size_t size);
+void  std_aligned_free(void* ptr);
+// memory aligned by page size, min alignment: 4096 bytes
+void* aligned_large_pages_alloc(size_t size);
+// nop if mem == nullptr
+void aligned_large_pages_free(void* mem);
 
 void dbg_hit_on(bool cond, int slot = 0);
 void dbg_mean_of(int64_t value, int slot = 0);
@@ -66,7 +72,7 @@ std::ostream& operator<<(std::ostream&, SyncCout);
 #define sync_endl std::endl << IO_UNLOCK
 
 
-// align_ptr_up() : get the first aligned element of an array.
+// Get the first aligned element of an array.
 // ptr must point to an array of size at least `sizeof(T) * N + alignment` bytes,
 // where N is the number of elements in the array.
 template<uintptr_t Alignment, typename T>
@@ -79,7 +85,7 @@ T* align_ptr_up(T* ptr) {
 }
 
 
-// IsLittleEndian : true if and only if the binary is compiled on a little-endian machine
+// True if and only if the binary is compiled on a little-endian machine
 static inline const union {
     uint32_t i;
     char     c[4];
@@ -166,7 +172,6 @@ inline uint64_t mul_hi64(uint64_t a, uint64_t b) {
 // cores. To overcome this, some special platform-specific API should be
 // called to set group affinity for each thread. Original code from Texel by
 // Peter Ă–sterlund.
-
 namespace WinProcGroup {
 void bindThisThread(size_t idx);
 }