diff options
author | Chris Robinson <[email protected]> | 2019-07-26 14:02:14 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-07-26 14:02:14 -0700 |
commit | 7cfb353334c725b3f57a4a2951b4ff9e352fc956 (patch) | |
tree | f5108e9a62528e556463d83008eaf0cbedf8489a /common/almalloc.cpp | |
parent | b22ecc45c9183572370895790cf955c490196b1f (diff) |
Don't explicitly check for standard functions
Diffstat (limited to 'common/almalloc.cpp')
-rw-r--r-- | common/almalloc.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/almalloc.cpp b/common/almalloc.cpp index f94ae8bc..2902a087 100644 --- a/common/almalloc.cpp +++ b/common/almalloc.cpp @@ -17,12 +17,14 @@ #endif +#define ALIGNED_ALLOC_AVAILABLE (__STDC_VERSION__ >= 201112L || __cplusplus >= 201703L) + void *al_malloc(size_t alignment, size_t size) { assert((alignment & (alignment-1)) == 0); alignment = std::max(alignment, alignof(std::max_align_t)); -#if defined(HAVE_ALIGNED_ALLOC) +#if ALIGNED_ALLOC_AVAILABLE size = (size+(alignment-1))&~(alignment-1); return aligned_alloc(alignment, size); #elif defined(HAVE_POSIX_MEMALIGN) @@ -53,7 +55,7 @@ void *al_calloc(size_t alignment, size_t size) void al_free(void *ptr) noexcept { -#if defined(HAVE_ALIGNED_ALLOC) || defined(HAVE_POSIX_MEMALIGN) +#if ALIGNED_ALLOC_AVAILABLE || defined(HAVE_POSIX_MEMALIGN) free(ptr); #elif defined(HAVE__ALIGNED_MALLOC) _aligned_free(ptr); |