From 84acc85456cb0dceba4310dcbb6e9f6b516a6db9 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 16 Oct 2026 07:58:45 +0200 Subject: [PATCH] Fix misaligned allocations on PPC64 --- src/intrin_portable.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/intrin_portable.h b/src/intrin_portable.h index 98d265aa..1bf7452a 100644 --- a/src/intrin_portable.h +++ b/src/intrin_portable.h @@ -205,7 +205,23 @@ typedef union{ int i32[4]; } vec_u; +#ifdef HAVE_POSIX_MEMALIGN +#include + +inline void* rx_aligned_alloc(size_t size, size_t align) { + void* p; + if (posix_memalign(&p, align, size) == 0) + return p; + + return 0; +}; + +#else // HAVE_POSIX_MEMALIGN + #define rx_aligned_alloc(a, b) malloc(a) + +#endif // HAVE_POSIX_MEMALIGN + #define rx_aligned_free(a) free(a) #define rx_prefetch_nta(x) #define rx_prefetch_t0(x)