Codechange: Replace assert_compile macro with static_assert

This commit is contained in:
Charles Pigott
2020-12-27 10:44:22 +00:00
parent 395a5d9991
commit 860c270c73
77 changed files with 133 additions and 135 deletions

View File

@@ -112,7 +112,7 @@ static inline T Align(const T x, uint n)
template <typename T>
static inline T *AlignPtr(T *x, uint n)
{
assert_compile(sizeof(size_t) == sizeof(void *));
static_assert(sizeof(size_t) == sizeof(void *));
return reinterpret_cast<T *>(Align((size_t)x, n));
}

View File

@@ -80,7 +80,7 @@ private:
template <class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
struct Pool : PoolBase {
/* Ensure Tmax_size is within the bounds of Tindex. */
assert_compile((uint64)(Tmax_size - 1) >> 8 * sizeof(Tindex) == 0);
static_assert((uint64)(Tmax_size - 1) >> 8 * sizeof(Tindex) == 0);
static const size_t MAX_SIZE = Tmax_size; ///< Make template parameter accessible from outside