Made alignment a template parameter.

This commit is contained in:
Matthew Parkinson
2019-01-18 17:00:10 +00:00
parent a62e77f930
commit c1e23c497f
2 changed files with 3 additions and 2 deletions

View File

@@ -68,7 +68,8 @@ namespace snmalloc
* Primitive allocator for structure that are required before
* the allocator can be running.
***/
void* alloc_chunk(size_t size, size_t alignment = 64)
template<size_t alignment = 64>
void* alloc_chunk(size_t size)
{
// Cache line align
size = bits::align_up(size, 64);

View File

@@ -87,7 +87,7 @@ namespace snmalloc
{
auto& v = default_memory_provider;
value =
(PagemapEntry*)v.alloc_chunk(PAGEMAP_NODE_SIZE, OS_PAGE_SIZE);
(PagemapEntry*)v.alloc_chunk<OS_PAGE_SIZE>(PAGEMAP_NODE_SIZE);
e->store(value, std::memory_order_release);
}
else