Go to the documentation of this file.
12#define VLA(TYPE, NAME, LENGTH) \
13 TYPE NAME##_storage[(LENGTH)]; \
14 std::span NAME{NAME##_storage, size_t(LENGTH)}
16#if defined __i386 || defined __x86_64
17#define VLA_ALIGNED(TYPE, NAME, LENGTH, ALIGNMENT) \
18 TYPE NAME##_storage[(LENGTH)] __attribute__((__aligned__((ALIGNMENT)))); \
19 std::span NAME{NAME##_storage, size_t(LENGTH)}
25#define VLA_ALIGNED(TYPE, NAME, LENGTH, ALIGNMENT) \
26 UNABLE_TO_GUARANTEE_VLA_ALIGNMENT_ON_THIS_ARCHITECTURE
31#define VLA(TYPE, NAME, LENGTH) \
32 auto NAME##_storage = static_cast<TYPE*>(_alloca(sizeof(TYPE) * (LENGTH))); \
33 std::span NAME{NAME##_storage, size_t(LENGTH)}
36#define VLA_ALIGNED(TYPE, NAME, LENGTH, ALIGNMENT) \
37 size_t cbAlign##NAME = (ALIGNMENT); \
38 void* palloc##NAME = _alloca(sizeof(TYPE) * (LENGTH) + cbAlign##NAME); \
39 palloc##NAME = (void*)((size_t(palloc##NAME) + cbAlign##NAME - 1UL) & ~(cbAlign##NAME - 1UL)); \
40 auto NAME##_storage = static_cast<TYPE*>(palloc##NAME); \
41 std::span NAME{NAME##_storage, size_t(LENGTH)}
48#define VLA_SSE_ALIGNED(TYPE, NAME, LENGTH) VLA_ALIGNED(TYPE, NAME, LENGTH, 16)
50#define VLA_SSE_ALIGNED(TYPE, NAME, LENGTH) VLA(TYPE, NAME, LENGTH)