Skip to content

Commit

Permalink
Buddy range: assert that MAX > MIN
Browse files Browse the repository at this point in the history
Now that the case leading to several 0-sized arrays in Buddy ranges, that then
cause gcc's -Warray-bounds to trip, has been removed, add a static assert so
that we can catch this with better error messages next time.
  • Loading branch information
nwf-msr committed Sep 4, 2024
1 parent e02360b commit 51c609e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/snmalloc/backend_helpers/buddy.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace snmalloc
template<typename Rep, size_t MIN_SIZE_BITS, size_t MAX_SIZE_BITS>
class Buddy
{
static_assert(MAX_SIZE_BITS > MIN_SIZE_BITS);

struct Entry
{
typename Rep::Contents cache[3];
Expand Down

0 comments on commit 51c609e

Please sign in to comment.