Update to use a more efficient power of 2 check. (#274)
This commit is contained in:
committed by
GitHub
parent
db3580a9d8
commit
a3660c4069
@@ -175,7 +175,7 @@ namespace snmalloc
|
||||
template<bool committed>
|
||||
void* reserve(size_t size)
|
||||
{
|
||||
SNMALLOC_ASSERT(bits::next_pow2(size) == size);
|
||||
SNMALLOC_ASSERT(bits::is_pow2(size));
|
||||
SNMALLOC_ASSERT(size >= sizeof(void*));
|
||||
|
||||
if constexpr (pal_supports<AlignedAllocation, PAL>)
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace snmalloc
|
||||
// Client responsible for checking alignment is not zero
|
||||
SNMALLOC_ASSERT(alignment != 0);
|
||||
// Client responsible for checking alignment is a power of two
|
||||
SNMALLOC_ASSERT(bits::next_pow2(alignment) == alignment);
|
||||
SNMALLOC_ASSERT(bits::is_pow2(alignment));
|
||||
|
||||
return ((alignment - 1) | (size - 1)) + 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user