[Piglit] [PATCH] util: Add piglit_alloc_aligned support for Mac OS X.

Vinson Lee vlee at freedesktop.org
Sat Feb 21 01:04:03 PST 2015


Mac OS X does not have aligned_alloc or memalign.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89259
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/util/piglit-util.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 76a13ac..ec1db49 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -829,6 +829,10 @@ piglit_alloc_aligned(size_t size, size_t alignment)
 {
 #if defined(_WIN32)
    return _aligned_malloc(size, alignment);
+#elif defined(__APPLE__)
+   void *memptr;
+   posix_memalign(&memptr, alignment, size);
+   return memptr;
 #else
    return aligned_alloc(alignment, size);
 #endif
-- 
2.2.1



More information about the Piglit mailing list