]> git.sesse.net Git - stockfish/commitdiff
Fix build on arm windows
authorborg323 <borg323@users.noreply.github.com>
Thu, 9 Feb 2023 19:14:59 +0000 (21:14 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sat, 18 Feb 2023 12:14:05 +0000 (13:14 +0100)
avoids the use of _mm_malloc on arm windows.

fixes #4379
closes https://github.com/official-stockfish/Stockfish/pull/4388

No functional change

AUTHORS
src/misc.cpp

diff --git a/AUTHORS b/AUTHORS
index 42ba5930343d3eb5a15dd8e50957b39f7e2c5cf9..634de4a3d906102236195fe42133a1dd99d14566 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -35,6 +35,7 @@ Ben Chaney (Chaneybenjamini)
 Ben Koshy (BKSpurgeon)
 Bill Henry (VoyagerOne)
 Bojun Guo (noobpwnftw, Nooby)
+borg323
 BoĊĦtjan Mejak (PedanticHacker)
 braich
 Brian Sheppard (SapphireBrand, briansheppard-toast)
index 7d848d32693e2091b3ced5eab4820c8e210cfeb1..e65faab9422cc33473a72be0ecf22cdf146ee95a 100644 (file)
@@ -448,8 +448,10 @@ void* std_aligned_alloc(size_t alignment, size_t size) {
 #if defined(POSIXALIGNEDALLOC)
   void *mem;
   return posix_memalign(&mem, alignment, size) ? nullptr : mem;
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
   return _mm_malloc(size, alignment);
+#elif defined(_WIN32)
+  return _aligned_malloc(size, alignment);
 #else
   return std::aligned_alloc(alignment, size);
 #endif
@@ -459,8 +461,10 @@ void std_aligned_free(void* ptr) {
 
 #if defined(POSIXALIGNEDALLOC)
   free(ptr);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
   _mm_free(ptr);
+#elif defined(_WIN32)
+  _aligned_free(ptr);
 #else
   free(ptr);
 #endif