]> git.sesse.net Git - stockfish/commitdiff
Do not try to use large pages on 32 bit Windows.
authornoobpwnftw <guo.bojun@gmail.com>
Wed, 3 Mar 2021 14:30:23 +0000 (22:30 +0800)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 7 Mar 2021 19:02:11 +0000 (20:02 +0100)
verified to work on windows XP.

fixes  #3379

closes https://github.com/official-stockfish/Stockfish/pull/3380

No functional change.

src/misc.cpp

index 834e909b981b381bf5434cd611b266d6406ecdde..7600fc114c2f6a9d411170935556526d4bf22a43 100644 (file)
@@ -362,7 +362,7 @@ void std_aligned_free(void* ptr) {
 /// aligned_large_pages_alloc() will return suitably aligned memory, if possible using large pages.
 
 #if defined(_WIN32)
-
+#if defined(_WIN64)
 static void* aligned_large_pages_alloc_win(size_t allocSize) {
 
   HANDLE hProcessToken { };
@@ -407,15 +407,20 @@ static void* aligned_large_pages_alloc_win(size_t allocSize) {
 
   return mem;
 }
+#endif
 
 void* aligned_large_pages_alloc(size_t allocSize) {
 
+#if defined(_WIN64)
   // Try to allocate large pages
   void* mem = aligned_large_pages_alloc_win(allocSize);
 
   // Fall back to regular, page aligned, allocation if necessary
   if (!mem)
       mem = VirtualAlloc(NULL, allocSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+#else
+  void* mem = VirtualAlloc(NULL, allocSize, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+#endif
 
   return mem;
 }