[Bf-blender-cvs] [c80564ef9f5] master: macOS: Enabled posix_memalign() like on other Unix platforms.
Stefan Werner
noreply at git.blender.org
Fri Sep 13 22:49:38 CEST 2019
Commit: c80564ef9f557fadd235b87533b24d126e2138c9
Author: Stefan Werner
Date: Fri Sep 13 22:49:26 2019 +0200
Branches: master
https://developer.blender.org/rBc80564ef9f557fadd235b87533b24d126e2138c9
macOS: Enabled posix_memalign() like on other Unix platforms.
===================================================================
M intern/cycles/util/util_aligned_malloc.cpp
M intern/guardedalloc/intern/mallocn.c
M intern/libmv/libmv/base/aligned_malloc.cc
===================================================================
diff --git a/intern/cycles/util/util_aligned_malloc.cpp b/intern/cycles/util/util_aligned_malloc.cpp
index 104e6c5e3f4..9b729cd4fc4 100644
--- a/intern/cycles/util/util_aligned_malloc.cpp
+++ b/intern/cycles/util/util_aligned_malloc.cpp
@@ -46,13 +46,7 @@ void *util_aligned_malloc(size_t size, int alignment)
return MEM_mallocN_aligned(size, alignment, "Cycles Aligned Alloc");
#elif defined(_WIN32)
return _aligned_malloc(size, alignment);
-#elif defined(__APPLE__)
- /* On Mac OS X, both the heap and the stack are guaranteed 16-byte aligned so
- * they work natively with SSE types with no further work.
- */
- assert(alignment == 16);
- return malloc(size);
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
void *result;
if (posix_memalign(&result, alignment, size)) {
/* Non-zero means allocation error
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 1c96856fd0d..ac970a8c610 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -72,14 +72,7 @@ void *aligned_malloc(size_t size, size_t alignment)
{
#ifdef _WIN32
return _aligned_malloc(size, alignment);
-#elif defined(__APPLE__)
- /* On Mac OS X, both the heap and the stack are guaranteed 16-byte aligned so
- * they work natively with SSE types with no further work.
- */
- assert(alignment == 16);
- (void)alignment;
- return malloc(size);
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined (__APPLE__)
void *result;
if (posix_memalign(&result, alignment, size)) {
diff --git a/intern/libmv/libmv/base/aligned_malloc.cc b/intern/libmv/libmv/base/aligned_malloc.cc
index cc0a5fbbba7..5d3e05e9df9 100644
--- a/intern/libmv/libmv/base/aligned_malloc.cc
+++ b/intern/libmv/libmv/base/aligned_malloc.cc
@@ -44,12 +44,7 @@ namespace libmv {
void *aligned_malloc(int size, int alignment) {
#ifdef _WIN32
return _aligned_malloc(size, alignment);
-#elif defined(__APPLE__)
- // On Mac OS X, both the heap and the stack are guaranteed 16-byte aligned so
- // they work natively with SSE types with no further work.
- CHECK_EQ(alignment, 16);
- return malloc(size);
-#elif defined(__FreeBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
void *result;
if (posix_memalign(&result, alignment, size)) {
More information about the Bf-blender-cvs
mailing list