common: Convert type traits templates over to variable template versions where applicable

Uses the C++17 inline variable variants
This commit is contained in:
Lioncash 2018-08-07 13:31:57 -04:00
parent 825e8cb925
commit a7d6efc520
5 changed files with 11 additions and 11 deletions

View file

@ -9,13 +9,13 @@ namespace Common {
template <typename T>
constexpr T AlignUp(T value, size_t size) {
static_assert(std::is_unsigned<T>::value, "T must be an unsigned value.");
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
return static_cast<T>(value + (size - value % size) % size);
}
template <typename T>
constexpr T AlignDown(T value, size_t size) {
static_assert(std::is_unsigned<T>::value, "T must be an unsigned value.");
static_assert(std::is_unsigned_v<T>, "T must be an unsigned value.");
return static_cast<T>(value - value % size);
}