8 #if defined(PLATFORM_AMD64_SYSV) || defined(PLATFORM_AMD64_WINDOWS)
10 #elif defined(PLATFORM_X86_FASTCALL)
12 #elif defined(PLATFORM_AARCH64_AAPCS)
14 #elif defined(PLATFORM_SETJMP)
16 #elif defined(PLATFORM_UCONTEXT)
20 template <
class ImplClass,
typename ...Args>
21 static constexpr
auto AllocImplHelper(std::span<uintptr_t> buffer,
bool &bufferUsed, Args && ...args) {
22 const auto bytes{buffer.size() *
sizeof(uintptr_t)};
24 if(
sizeof(ImplClass) <= bytes &&
alignof(ImplClass) <=
sizeof(uintptr_t)) {
26 auto mem =
reinterpret_cast<ImplClass *
>(buffer.data());
27 return new(mem) ImplClass(std::forward<Args>(args)...);
30 return new ImplClass(std::forward<Args>(args)...);
37 template <
typename ...Args>
38 static constexpr
auto AllocImpl(std::span<uintptr_t> buffer,
bool &bufferUsed, Args && ...args) {
41 #if defined(PLATFORM_AMD64_SYSV) || defined(PLATFORM_AMD64_WINDOWS)
42 return AllocImplHelper<Amd64>(buffer, bufferUsed, std::forward<Args>(args)...);
43 #elif defined(PLATFORM_X86_FASTCALL)
44 return AllocImplHelper<x86>(buffer, bufferUsed, std::forward<Args>(args)...);
45 #elif defined(PLATFORM_AARCH64_AAPCS)
46 return AllocImplHelper<Aarch64>(buffer, bufferUsed, std::forward<Args>(args)...);
47 #elif defined(PLATFORM_SETJMP)
48 return AllocImplHelper<SetJmp>(buffer, bufferUsed, std::forward<Args>(args)...);
49 #elif defined(PLATFORM_UCONTEXT)
50 return AllocImplHelper<UContext>(buffer, bufferUsed, std::forward<Args>(args)...);
52 #error Do not know how to allocate implementation for current platform!
Implementation details (including architecture/platform specific code) for the library.