Merge pull request #2127 from neheb/21

use make_unsigned_t
This commit is contained in:
Luis Díaz Más 2022-03-07 08:45:19 +01:00 committed by GitHub
commit ffb5cdf721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1248,8 +1248,7 @@ namespace Exiv2 {
}
} else if (std::is_signed<I>::value) {
// conversion is from unsigned to signed
const auto imax =
static_cast<typename std::make_unsigned<I>::type>(std::numeric_limits<I>::max());
const auto imax = std::make_unsigned_t<I>(std::numeric_limits<I>::max());
if (imax < b || imax < a) {
return 0;
}
@ -1260,8 +1259,8 @@ namespace Exiv2 {
return 0;
}
// Inputs are not negative so convert them to unsigned.
const auto a_u = static_cast<typename std::make_unsigned<decltype(a)>::type>(a);
const auto b_u = static_cast<typename std::make_unsigned<decltype(b)>::type>(b);
const auto a_u = std::make_unsigned_t<decltype(a)>(a);
const auto b_u = std::make_unsigned_t<decltype(b)>(b);
if (imax < b_u || imax < a_u) {
return 0;
}