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:
Matthew Parkinson
2019-06-26 17:40:26 +01:00
parent 830b06a616
commit 7a8eaec2cc
9 changed files with 81 additions and 69 deletions

View File

@@ -2,7 +2,7 @@
#include <snmalloc.h>
NOINLINE
uint8_t size_to_sizeclass(size_t size)
snmalloc::sizeclass_t size_to_sizeclass(size_t size)
{
return snmalloc::size_to_sizeclass(size);
}
@@ -17,7 +17,7 @@ int main(int, char**)
std::cout << "sizeclass |-> [size_low, size_high] " << std::endl;
for (uint8_t sz = 0; sz < snmalloc::NUM_SIZECLASSES; sz++)
for (snmalloc::sizeclass_t sz = 0; sz < snmalloc::NUM_SIZECLASSES; sz++)
{
// Separate printing for small and medium sizeclasses
if (sz == snmalloc::NUM_SMALL_CLASSES)