52 static inline size_t align_up(
size_t value,
size_t alignment)
54 return (value + alignment - 1) & ~(alignment - 1);
81#if defined(__has_builtin)
82#if __has_builtin(__builtin_mul_overflow)
83 return __builtin_mul_overflow(a, b, result);
126#if SIZE_MAX > UINT32_MAX
static bool would_overflow_mul(size_t a, size_t b, size_t *result)
Perform a checked multiplication of two size_t values.
static size_t align_up(size_t value, size_t alignment)
Align a value upwards to the nearest multiple of alignment.
static size_t next_power_of_two(size_t x)
Return the next power of two greater than or equal to x.