Handle 2^16 slabs
This code assumes that 16bit uint wrapping can be used, rather than masking by SLAB_SIZE-1. Add explicit mask, so we can change the SLAB_SIZE to be smaller.
This commit is contained in:
@@ -58,7 +58,7 @@ namespace snmalloc
|
||||
{
|
||||
// This slab is being bump allocated.
|
||||
p = (void*)((size_t)this + head - 1);
|
||||
meta->head = head + (uint16_t)rsize;
|
||||
meta->head = (head + (uint16_t)rsize) & (SLAB_SIZE - 1);
|
||||
if (meta->head == 1)
|
||||
{
|
||||
meta->set_full();
|
||||
|
||||
Reference in New Issue
Block a user