Skip to content

Commit d3ecd66

Browse files
committed
Add constexpr annotation to align_up/down.
1 parent 17d5a3e commit d3ecd66

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/ds/bits.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,19 @@ namespace snmalloc
241241
return BITS - clz_const(x - 1);
242242
}
243243

244-
static SNMALLOC_FAST_PATH size_t align_down(size_t value, size_t alignment)
244+
constexpr SNMALLOC_FAST_PATH size_t
245+
align_down(size_t value, size_t alignment)
245246
{
246-
SNMALLOC_ASSERT(next_pow2(alignment) == alignment);
247+
SNMALLOC_ASSERT(next_pow2_const(alignment) == alignment);
247248

248249
size_t align_1 = alignment - 1;
249250
value &= ~align_1;
250251
return value;
251252
}
252253

253-
static inline size_t align_up(size_t value, size_t alignment)
254+
constexpr SNMALLOC_FAST_PATH size_t align_up(size_t value, size_t alignment)
254255
{
255-
SNMALLOC_ASSERT(next_pow2(alignment) == alignment);
256+
SNMALLOC_ASSERT(next_pow2_const(alignment) == alignment);
256257

257258
size_t align_1 = alignment - 1;
258259
value += align_1;

0 commit comments

Comments
 (0)