From a83b6ac657cf048605056b6fea5bb833b45c131e Mon Sep 17 00:00:00 2001 From: Qiang Kou Date: Fri, 4 Sep 2015 14:36:40 -0400 Subject: [PATCH] compile on mac osx --- src/storage/cpu_device_storage.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/storage/cpu_device_storage.h b/src/storage/cpu_device_storage.h index 0b69b6b4fd8d..1241a56e0d12 100644 --- a/src/storage/cpu_device_storage.h +++ b/src/storage/cpu_device_storage.h @@ -38,7 +38,13 @@ class CPUDeviceStorage { }; // class CPUDeviceStorage inline void* CPUDeviceStorage::Alloc(size_t size) { +#ifdef __APPLE__ + return CHECK_NOTNULL(malloc(size)); +#elif _MSC_VER + return CHECK_NOTNULL(_aligned_malloc(size, alignment_)); +#else return CHECK_NOTNULL(memalign(alignment_, size)); +#endif } inline void CPUDeviceStorage::Free(void* ptr) { free(ptr); }