diff options
-rw-r--r-- | src/lib/netlist/plib/palloc.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/netlist/plib/palloc.h b/src/lib/netlist/plib/palloc.h index a2f4527adb1..e1ad17637fe 100644 --- a/src/lib/netlist/plib/palloc.h +++ b/src/lib/netlist/plib/palloc.h @@ -241,10 +241,12 @@ namespace plib { public: using value_type = T; using pointer = T *; - static /*constexpr*/ const std::size_t align_size = ALIGN; + static /*constexpr*/ const std::size_t align_size = (ALIGN < 16) ? 16 : ALIGN; using arena_type = ARENA; - static_assert(align_size >= alignof(T) && (align_size % alignof(T)) == 0, + static_assert(align_size >= alignof(T), + "ALIGN must be greater than alignof(T) and a multiple"); + static_assert((align_size % alignof(T)) == 0, "ALIGN must be greater than alignof(T) and a multiple"); arena_allocator() noexcept @@ -436,8 +438,12 @@ namespace plib { //unused_var(size); dec_alloc_stat(size); #if (PUSE_ALIGNED_ALLOCATION) - // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) + #if defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER) + _aligned_free(ptr); + #else + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) ::free(ptr); + #endif #else ::operator delete(ptr); #endif |