[Piglit] [PATCH] util: Add piglit_alloc_aligned support for Mac OS X.
Jose Fonseca
jfonseca at vmware.com
Sat Feb 21 04:51:08 PST 2015
Sorry Vinson, I just pushed a similar patch without realizing you had
already posted this for review.
Note that posix_memalign indicates failure via return value.
Jose
On 21/02/15 09:04, Vinson Lee wrote:
> Mac OS X does not have aligned_alloc or memalign.
>
> Bugzilla: https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D89259&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=FoQ44zSGSEY8lI2-dPJESnX2FsJvThPqtap_Q8NsSAo&s=4_gTbLDKlpt3wsybEBrnc_Z0QRNLONYBEGciQvvbVBY&e=
> 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
>
More information about the Piglit
mailing list