Remove all instances of static_cast<size_t>(1).

In preparation for removing magic numbers, simplify code that is
computing masks with a single bit set.
This commit is contained in:
David Chisnall
2019-04-30 11:49:00 +01:00
parent 95c23b1a00
commit 8bd136c224
7 changed files with 32 additions and 23 deletions

View File

@@ -30,8 +30,7 @@ namespace snmalloc
bits::from_exp_mant<INTERMEDIATE_BITS, MIN_ALLOC_BITS>(sizeclass);
size_t alignment = bits::min(
static_cast<size_t>(1) << bits::ctz_const(size[sizeclass]),
OS_PAGE_SIZE);
bits::one_at_bit(bits::ctz_const(size[sizeclass])), OS_PAGE_SIZE);
cache_friendly_mask[sizeclass] = (alignment - 1);
inverse_cache_friendly_mask[sizeclass] = ~(alignment - 1);
}