Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use make_unsigned_t #2127

Merged
merged 1 commit into from
Mar 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions include/exiv2/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down