diff options
author | Chris Robinson <[email protected]> | 2019-06-06 00:37:00 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-06-06 00:37:00 -0700 |
commit | 585b0cf3bed7d1c5720633eb7e5358a9fca865f6 (patch) | |
tree | 1aa5d6b51afe900d2a1cbb069202c368a46f947a /common/almalloc.cpp | |
parent | a7be53104953ac67081db8e539d423509f44f801 (diff) |
Remove the DEF_ALIGN macro
Diffstat (limited to 'common/almalloc.cpp')
-rw-r--r-- | common/almalloc.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/common/almalloc.cpp b/common/almalloc.cpp index f7af5bf3..fbb84479 100644 --- a/common/almalloc.cpp +++ b/common/almalloc.cpp @@ -4,6 +4,7 @@ #include "almalloc.h" #include <cassert> +#include <cstddef> #include <cstdlib> #include <cstring> #ifdef HAVE_MALLOC_H @@ -28,7 +29,7 @@ void *al_malloc(size_t alignment, size_t size) { assert((alignment & (alignment-1)) == 0); - alignment = std::max(alignment, sizeof(void*)); + alignment = std::max(alignment, alignof(std::max_align_t)); #if defined(HAVE_ALIGNED_ALLOC) size = (size+(alignment-1))&~(alignment-1); @@ -79,7 +80,7 @@ void al_free(void *ptr) noexcept size_t al_get_page_size() noexcept { - static size_t psize = 0; + static size_t psize{0u}; if(UNLIKELY(!psize)) { #ifdef HAVE_SYSCONF @@ -97,7 +98,7 @@ size_t al_get_page_size() noexcept psize = sysinfo.dwPageSize; } #endif - if(!psize) psize = DEF_ALIGN; + if(!psize) psize = alignof(std::max_align_t); } return psize; } |