summaryrefslogtreecommitdiff
path: root/zutil_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'zutil_p.h')
-rw-r--r--zutil_p.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/zutil_p.h b/zutil_p.h
index 55f0061..856b44f 100644
--- a/zutil_p.h
+++ b/zutil_p.h
@@ -9,7 +9,7 @@
# define _POSIX_C_SOURCE 200112L /* For posix_memalign(). */
#endif
-#if defined(__APPLE__) || defined(HAVE_POSIX_MEMALIGN)
+#if defined(__APPLE__) || defined(HAVE_POSIX_MEMALIGN) || defined(HAVE_ALIGNED_ALLOC)
# include <stdlib.h>
#elif defined(__FreeBSD__)
# include <stdlib.h>
@@ -27,6 +27,8 @@ static inline void *zng_alloc(size_t size) {
return (void *)_aligned_malloc(size, 64);
#elif defined(__APPLE__)
return (void *)malloc(size); /* MacOS always aligns to 16 bytes */
+#elif defined(HAVE_ALIGNED_ALLOC)
+ return (void *)aligned_alloc(64, size);
#else
return (void *)memalign(64, size);
#endif