1
0
Fork 0

Use fallback implementation for C++ aligned_alloc

fixes https://github.com/official-stockfish/Stockfish/issues/2921

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

No functional change
alignedAllocMinGW
Daniel Dugovic 2020-08-08 15:39:29 -05:00 committed by Joost VandeVondele
parent add890a10b
commit d7a26899a9
2 changed files with 6 additions and 6 deletions

View File

@ -354,8 +354,8 @@ endif
endif endif
ifeq ($(KERNEL),Darwin) ifeq ($(KERNEL),Darwin)
CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.15 CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.13
LDFLAGS += -arch $(arch) -mmacosx-version-min=10.15 LDFLAGS += -arch $(arch) -mmacosx-version-min=10.13
endif endif
### Travis CI script uses COMPILER to overwrite CXX ### Travis CI script uses COMPILER to overwrite CXX

View File

@ -321,9 +321,9 @@ void prefetch(void* addr) {
/// ///
void* std_aligned_alloc(size_t alignment, size_t size) { void* std_aligned_alloc(size_t alignment, size_t size) {
#if defined(__APPLE__) #if (defined(__APPLE__) && defined(_LIBCPP_HAS_C11_FEATURES)) || defined(__ANDROID__) || defined(__OpenBSD__) || (defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) )
return aligned_alloc(alignment, size); return aligned_alloc(alignment, size);
#elif defined(_WIN32) #elif (defined(_WIN32) || (defined(__APPLE__) && !defined(_LIBCPP_HAS_C11_FEATURES)))
return _mm_malloc(size, alignment); return _mm_malloc(size, alignment);
#else #else
return std::aligned_alloc(alignment, size); return std::aligned_alloc(alignment, size);
@ -331,9 +331,9 @@ void* std_aligned_alloc(size_t alignment, size_t size) {
} }
void std_aligned_free(void* ptr) { void std_aligned_free(void* ptr) {
#if defined(__APPLE__) #if (defined(__APPLE__) && defined(_LIBCPP_HAS_C11_FEATURES)) || defined(__ANDROID__) || defined(__OpenBSD__) || (defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC) )
free(ptr); free(ptr);
#elif defined(_WIN32) #elif (defined(_WIN32) || (defined(__APPLE__) && !defined(_LIBCPP_HAS_C11_FEATURES)))
_mm_free(ptr); _mm_free(ptr);
#else #else
free(ptr); free(ptr);