@@ -49,7 +49,7 @@ namespace snmalloc
49
49
template <size_t alignment>
50
50
static inline bool is_aligned_block (void * p, size_t size)
51
51
{
52
- static_assert (bits::next_pow2_const (alignment) == alignment );
52
+ static_assert (bits::is_pow2 (alignment));
53
53
54
54
return ((address_cast (p) | size) & (alignment - 1 )) == 0 ;
55
55
}
@@ -62,7 +62,7 @@ namespace snmalloc
62
62
SNMALLOC_FAST_PATH T* pointer_align_down (void * p)
63
63
{
64
64
static_assert (alignment > 0 );
65
- static_assert (bits::next_pow2_const (alignment) == alignment );
65
+ static_assert (bits::is_pow2 (alignment));
66
66
if constexpr (alignment == 1 )
67
67
return static_cast <T*>(p);
68
68
else
@@ -84,7 +84,7 @@ namespace snmalloc
84
84
inline T* pointer_align_up (void * p)
85
85
{
86
86
static_assert (alignment > 0 );
87
- static_assert (bits::next_pow2_const (alignment) == alignment );
87
+ static_assert (bits::is_pow2 (alignment));
88
88
if constexpr (alignment == 1 )
89
89
return static_cast <T*>(p);
90
90
else
@@ -106,7 +106,7 @@ namespace snmalloc
106
106
SNMALLOC_FAST_PATH T* pointer_align_down (void * p, size_t alignment)
107
107
{
108
108
SNMALLOC_ASSERT (alignment > 0 );
109
- SNMALLOC_ASSERT (bits::next_pow2 (alignment) == alignment );
109
+ SNMALLOC_ASSERT (bits::is_pow2 (alignment));
110
110
#if __has_builtin(__builtin_align_down)
111
111
return static_cast <T*>(__builtin_align_down (p, alignment));
112
112
#else
@@ -123,7 +123,7 @@ namespace snmalloc
123
123
inline T* pointer_align_up (void * p, size_t alignment)
124
124
{
125
125
SNMALLOC_ASSERT (alignment > 0 );
126
- SNMALLOC_ASSERT (bits::next_pow2 (alignment) == alignment );
126
+ SNMALLOC_ASSERT (bits::is_pow2 (alignment));
127
127
#if __has_builtin(__builtin_align_up)
128
128
return static_cast <T*>(__builtin_align_up (p, alignment));
129
129
#else
0 commit comments