Clang format
This commit is contained in:
committed by
Matthew Parkinson
parent
3adfe00f51
commit
234c0e2e8e
@@ -73,7 +73,7 @@ namespace snmalloc
|
||||
|
||||
return BITS - index - 1;
|
||||
# endif
|
||||
#else
|
||||
#else
|
||||
if constexpr (std::is_same_v<unsigned long, std::size_t>)
|
||||
{
|
||||
return static_cast<size_t>(__builtin_clzl(x));
|
||||
|
||||
@@ -2,31 +2,33 @@
|
||||
* Unit tests for operations in bits.h
|
||||
*/
|
||||
|
||||
#include <ds/bits.h>
|
||||
#include <iostream>
|
||||
#include <test/setup.h>
|
||||
#include <ds/bits.h>
|
||||
|
||||
void
|
||||
test_ctz()
|
||||
void test_ctz()
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(size_t) * 8; i++)
|
||||
if (snmalloc::bits::ctz(snmalloc::bits::one_at_bit(i)) != i)
|
||||
{
|
||||
std::cout << "Failed with ctz(one_at_bit(i)) != i for i=" << i << std::endl;
|
||||
std::cout << "Failed with ctz(one_at_bit(i)) != i for i=" << i
|
||||
<< std::endl;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
test_clz()
|
||||
void test_clz()
|
||||
{
|
||||
const size_t PTRSIZE_LOG = sizeof(size_t) * 8;
|
||||
|
||||
for (size_t i = 0; i < sizeof(size_t) * 8; i++)
|
||||
if (snmalloc::bits::clz(snmalloc::bits::one_at_bit(i)) != (PTRSIZE_LOG - i - 1))
|
||||
if (
|
||||
snmalloc::bits::clz(snmalloc::bits::one_at_bit(i)) !=
|
||||
(PTRSIZE_LOG - i - 1))
|
||||
{
|
||||
std::cout << "Failed with clz(one_at_bit(i)) != (PTRSIZE_LOG - i - 1) for i=" << i << std::endl;
|
||||
std::cout
|
||||
<< "Failed with clz(one_at_bit(i)) != (PTRSIZE_LOG - i - 1) for i=" << i
|
||||
<< std::endl;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user