7#if defined(__GLIBC__) && ((__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 8) || __GLIBC__ > 2) && defined(__LP64__)
8#define KTL_GLIBC_MALLOC_ALREADY_ALIGNED 1
10#define KTL_GLIBC_MALLOC_ALREADY_ALIGNED 0
13#if defined(__FreeBSD__) && !defined(__arm__) && !defined(__mips__)
14#define KTL_FREEBSD_MALLOC_ALREADY_ALIGNED 1
16#define KTL_FREEBSD_MALLOC_ALREADY_ALIGNED 0
19#if (defined(__APPLE__) \
21 || KTL_GLIBC_MALLOC_ALREADY_ALIGNED \
22 || KTL_FREEBSD_MALLOC_ALREADY_ALIGNED)
23#define KTL_HAS_MALLOC_ALIGNED 1
25#define KTL_HAS_MALLOC_ALIGNED 0
30#if ((defined __QNXNTO__) || (defined _GNU_SOURCE) || ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600))) \
31 && (defined _POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO > 0)
32#define KTL_HAS_POSIX_MEMALIGN 1
34#define KTL_HAS_POSIX_MEMALIGN 0
40#define KTL_HAS_MM_MALLOC 1
42#define KTL_HAS_MM_MALLOC 0
50#if KTL_HAS_MALLOC_ALIGNED
52#elif KTL_HAS_MM_MALLOC
54#elif KTL_HAS_POSIX_MEMALIGN
59#elif defined(_MSC_VER)
67 *(
reinterpret_cast<void**
>(
res) - 1) =
ptr;
75#if KTL_HAS_MALLOC_ALIGNED
77#elif KTL_HAS_MM_MALLOC
79#elif KTL_HAS_POSIX_MEMALIGN
81#elif defined(_MSC_VER)
85 free(*(
reinterpret_cast<void**
>(
ptr) - 1));
89 template<
typename T,
typename...
Args>
91 noexcept(
noexcept(
T(std::declval<Args>()...)))
100 noexcept(
noexcept(
p->~T()))
Definition fallback_fwd.h:23
void * aligned_malloc(size_t size, size_t alignment) noexcept
Definition aligned_malloc.h:48
void aligned_delete(T *p) noexcept(noexcept(p->~T()))
Definition aligned_malloc.h:99
constexpr bool has_no_value_type_v
Definition meta.h:17
void aligned_free(void *ptr) noexcept
Definition aligned_malloc.h:73
T * aligned_new(size_t alignment, Args &&... args) noexcept(noexcept(T(std::declval< Args >()...)))
Definition aligned_malloc.h:90