diff --git a/src/mem/allocconfig.h b/src/mem/allocconfig.h index fd7fb53..01bc1d0 100644 --- a/src/mem/allocconfig.h +++ b/src/mem/allocconfig.h @@ -110,6 +110,8 @@ namespace snmalloc static constexpr size_t SUPERSLAB_BITS = SLAB_BITS + SLAB_COUNT_BITS; static constexpr size_t RESERVE_SIZE = SUPERSLAB_SIZE * RESERVE_MULTIPLE; + static_assert((1ULL << SUPERSLAB_BITS) == SUPERSLAB_SIZE, "Sanity check"); + // Number of slots for remote deallocation. static constexpr size_t REMOTE_SLOT_BITS = 6; static constexpr size_t REMOTE_SLOTS = 1 << REMOTE_SLOT_BITS; diff --git a/src/mem/sizeclass.h b/src/mem/sizeclass.h index 1561df2..36136f8 100644 --- a/src/mem/sizeclass.h +++ b/src/mem/sizeclass.h @@ -35,7 +35,7 @@ namespace snmalloc size_to_sizeclass_const((size_t)1 << SLAB_BITS) + 1; static constexpr size_t NUM_SIZECLASSES = - size_to_sizeclass_const((size_t)1 << SUPERSLAB_BITS); + size_to_sizeclass_const(SUPERSLAB_SIZE); // Medium classes range from (SLAB, SUPERSLAB), i.e. non-inclusive. static constexpr size_t NUM_MEDIUM_CLASSES = @@ -45,14 +45,6 @@ namespace snmalloc static constexpr size_t NUM_LARGE_CLASSES = bits::ADDRESS_BITS - SUPERSLAB_BITS; - template - constexpr void check_same() - { - static_assert(X == Y, "Values must be the same"); - } - - static_assert(size_to_sizeclass_const(SUPERSLAB_SIZE) == NUM_SIZECLASSES); - inline static size_t round_by_sizeclass(size_t rsize, size_t offset) { // check_same();