Skip to content

Commit

Permalink
Merge pull request #659 from invertego/mm_malloc
Browse files Browse the repository at this point in the history
Fix mismatched _mm_{malloc,free} with LLVM/MinGW
  • Loading branch information
jserv authored Jan 6, 2025
2 parents af7596e + f30790d commit 3a032c9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions sse2neon.h
Original file line number Diff line number Diff line change
Expand Up @@ -1977,20 +1977,18 @@ FORCE_INLINE __m128i _mm_loadu_si64(const void *p)
#if !defined(SSE2NEON_ALLOC_DEFINED)
FORCE_INLINE void *_mm_malloc(size_t size, size_t align)
{
#if defined(_WIN32)
return _aligned_malloc(size, align);
#else
void *ptr;
if (align == 1)
return malloc(size);
if (align == 2 || (sizeof(void *) == 8 && align == 4))
align = sizeof(void *);
#if defined(_WIN32)
ptr = _aligned_malloc(size, align);
if (ptr)
return ptr;
#else
if (!posix_memalign(&ptr, align, size))
return ptr;
#endif
return NULL;
#endif
}
#endif

Expand Down

0 comments on commit 3a032c9

Please sign in to comment.