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

@@ -24,9 +24,9 @@
template<typename T, uint S, uint N, typename U> static inline T Extract(U v)
{
/* Check if there are enough bits in v */
assert_compile(N == EnumPropsT<T>::num_bits);
assert_compile(S + N <= sizeof(U) * 8);
assert_compile(EnumPropsT<T>::end <= (1 << N));
static_assert(N == EnumPropsT<T>::num_bits);
static_assert(S + N <= sizeof(U) * 8);
static_assert(EnumPropsT<T>::end <= (1 << N));
U masked = GB(v, S, N);
return IsInsideMM(masked, EnumPropsT<T>::begin, EnumPropsT<T>::end) ? (T)masked : EnumPropsT<T>::invalid;
}