diff options
author | Chris Robinson <[email protected]> | 2021-01-23 03:27:18 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-01-23 03:27:18 -0800 |
commit | 3142fb30eaa451c955a1607b8cffe2069cbd15b2 (patch) | |
tree | e1d88fd1469d0a7185662d5747dc6fd6c62bae3f | |
parent | 6f87cc92fb9d89c988910a2843967fcd7b623a7e (diff) |
Remove some unnecessary function attributes
The alloc_size was wrong anyway since the function parameter takes the number
of objects to be allocated and the attribute declares which is the number of
bytes. The assume_aligned is unnecessary since the function is inlined and
al_malloc/al_calloc already have appropriate attributes for the compiler to
see.
-rw-r--r-- | common/almalloc.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/almalloc.h b/common/almalloc.h index 75388d9d..58bd5eed 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -82,14 +82,14 @@ struct allocator { using other = allocator<U, (alignment<alignof(U))?alignof(U):alignment>; }; - allocator() noexcept = default; + constexpr explicit allocator() noexcept = default; template<typename U, std::size_t N> - constexpr allocator(const allocator<U,N>&) noexcept { } + constexpr explicit allocator(const allocator<U,N>&) noexcept { } - [[gnu::assume_aligned(alignment), gnu::alloc_size(2)]] T *allocate(std::size_t n) + T *allocate(std::size_t n) { if(n > std::numeric_limits<std::size_t>::max()/sizeof(T)) throw std::bad_alloc(); - if(auto p = static_cast<T*>(al_malloc(alignment, n*sizeof(T)))) return p; + if(auto p = al_malloc(alignment, n*sizeof(T))) return static_cast<T*>(p); throw std::bad_alloc(); } void deallocate(T *p, std::size_t) noexcept { al_free(p); } |