|
|
|
@ -22,7 +22,7 @@
|
|
|
|
|
template <typename T>
|
|
|
|
|
constexpr T abs(const T a)
|
|
|
|
|
{
|
|
|
|
|
return (a < (T)0) ? -a : a;
|
|
|
|
|
return (a < static_cast<T>(0)) ? -a : a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -38,7 +38,7 @@ constexpr T Align(const T x, uint n)
|
|
|
|
|
{
|
|
|
|
|
assert((n & (n - 1)) == 0 && n != 0);
|
|
|
|
|
n--;
|
|
|
|
|
return (T)((x + n) & ~((T)n));
|
|
|
|
|
return static_cast<T>((x + n) & ~static_cast<T>(n));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -251,7 +251,7 @@ constexpr T Delta(const T a, const T b)
|
|
|
|
|
template <typename T>
|
|
|
|
|
constexpr bool IsInsideBS(const T x, const size_t base, const size_t size)
|
|
|
|
|
{
|
|
|
|
|
return (size_t)(x - base) < size;
|
|
|
|
|
return static_cast<size_t>(x - base) < size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -268,9 +268,9 @@ template <typename T, std::enable_if_t<std::disjunction_v<std::is_convertible<T,
|
|
|
|
|
constexpr bool IsInsideMM(const T x, const size_t min, const size_t max) noexcept
|
|
|
|
|
{
|
|
|
|
|
if constexpr (std::is_base_of_v<StrongTypedefBase, T>) {
|
|
|
|
|
return (size_t)(x.base() - min) < (max - min);
|
|
|
|
|
return static_cast<size_t>(x.base() - min) < (max - min);
|
|
|
|
|
} else {
|
|
|
|
|
return (size_t)(x - min) < (max - min);
|
|
|
|
|
return static_cast<size_t>(x - min) < (max - min);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|