Use std::make_unsigned_t (NFC)

This commit is contained in:
Kazu Hirata 2022-09-18 18:41:02 -07:00
parent 8dab452740
commit 2078350645
2 changed files with 2 additions and 2 deletions

View File

@ -772,7 +772,7 @@ template <typename T, typename U>
static void fill_clamp(T &dest, U src, typename T::value_type fallback) {
static_assert(std::is_unsigned<typename T::value_type>::value,
"Destination type must be unsigned.");
using UU = typename std::make_unsigned<U>::type;
using UU = std::make_unsigned_t<U>;
constexpr auto T_max = std::numeric_limits<typename T::value_type>::max();
dest = src >= 0 && static_cast<UU>(src) <= T_max ? src : fallback;
}

View File

@ -96,7 +96,7 @@ template <typename T, unsigned Bits> struct BitPatterns {
/// undefined operations over signed types (e.g. Bitwise shift operators).
/// Moreover same size casting from unsigned to signed is well defined but not
/// the other way around.
using Unsigned = typename std::make_unsigned<T>::type;
using Unsigned = std::make_unsigned_t<T>;
static_assert(sizeof(Unsigned) == sizeof(T), "Types must have same size");
static constexpr unsigned TypeBits = sizeof(Unsigned) * CHAR_BIT;