Made a sizecass_t to wrap the sizeclass
This is useful as codegen is nicer if we use size_t, but the semantics is uint8_t, and is stored as that in many places in the metadata. Ultimately should introduce a wrapper to check this invariant.
This commit is contained in:
@@ -44,7 +44,7 @@ namespace snmalloc
|
||||
return pointer_cast<Mediumslab>(address_cast(p) & SUPERSLAB_MASK);
|
||||
}
|
||||
|
||||
void init(RemoteAllocator* alloc, uint8_t sc, size_t rsize)
|
||||
void init(RemoteAllocator* alloc, sizeclass_t sc, size_t rsize)
|
||||
{
|
||||
assert(sc >= NUM_SMALL_CLASSES);
|
||||
assert((sc - NUM_SMALL_CLASSES) < NUM_MEDIUM_CLASSES);
|
||||
@@ -56,7 +56,7 @@ namespace snmalloc
|
||||
// initialise the allocation stack.
|
||||
if ((kind != Medium) || (sizeclass != sc))
|
||||
{
|
||||
sizeclass = sc;
|
||||
sizeclass = static_cast<uint8_t>(sc);
|
||||
uint16_t ssize = static_cast<uint16_t>(rsize >> 8);
|
||||
kind = Medium;
|
||||
free = medium_slab_free(sc);
|
||||
|
||||
Reference in New Issue
Block a user