Minor restructuring to move static_assert

This commit is contained in:
Matthew Parkinson
2019-01-21 17:53:30 +00:00
parent bb5027b454
commit 18dd15c2c0
2 changed files with 3 additions and 9 deletions

View File

@@ -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;

View File

@@ -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<size_t X, size_t Y>
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<NUM_LARGE_CLASSES, Globals::num_large_classes>();