1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Fix build on arm windows

avoids the use of _mm_malloc on arm windows.

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

No functional change
This commit is contained in:
borg323 2023-02-09 21:14:59 +02:00 committed by Joost VandeVondele
parent 05dea2ca46
commit e5f6d71b96
2 changed files with 7 additions and 2 deletions

View file

@ -35,6 +35,7 @@ Ben Chaney (Chaneybenjamini)
Ben Koshy (BKSpurgeon) Ben Koshy (BKSpurgeon)
Bill Henry (VoyagerOne) Bill Henry (VoyagerOne)
Bojun Guo (noobpwnftw, Nooby) Bojun Guo (noobpwnftw, Nooby)
borg323
Boštjan Mejak (PedanticHacker) Boštjan Mejak (PedanticHacker)
braich braich
Brian Sheppard (SapphireBrand, briansheppard-toast) Brian Sheppard (SapphireBrand, briansheppard-toast)

View file

@ -448,8 +448,10 @@ void* std_aligned_alloc(size_t alignment, size_t size) {
#if defined(POSIXALIGNEDALLOC) #if defined(POSIXALIGNEDALLOC)
void *mem; void *mem;
return posix_memalign(&mem, alignment, size) ? nullptr : 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); return _mm_malloc(size, alignment);
#elif defined(_WIN32)
return _aligned_malloc(size, alignment);
#else #else
return std::aligned_alloc(alignment, size); return std::aligned_alloc(alignment, size);
#endif #endif
@ -459,8 +461,10 @@ void std_aligned_free(void* ptr) {
#if defined(POSIXALIGNEDALLOC) #if defined(POSIXALIGNEDALLOC)
free(ptr); free(ptr);
#elif defined(_WIN32) #elif defined(_WIN32) && !defined(_M_ARM) && !defined(_M_ARM64)
_mm_free(ptr); _mm_free(ptr);
#elif defined(_WIN32)
_aligned_free(ptr);
#else #else
free(ptr); free(ptr);
#endif #endif