static_cast make_unsigned
Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
85a2b8c63b
commit
e87de698f3
@ -1288,9 +1288,9 @@ class ValueType : public Value {
|
||||
#endif
|
||||
// conversion is from unsigned to signed
|
||||
#if __cplusplus >= 201402L
|
||||
const auto imax = std::make_unsigned_t<I>(std::numeric_limits<I>::max());
|
||||
const auto imax = static_cast<std::make_unsigned_t<I>>(std::numeric_limits<I>::max());
|
||||
#else
|
||||
const auto imax = typename std::make_unsigned<I>::type(std::numeric_limits<I>::max());
|
||||
const auto imax = static_cast<typename std::make_unsigned<I>::type>(std::numeric_limits<I>::max());
|
||||
#endif
|
||||
if (imax < b || imax < a) {
|
||||
return 0;
|
||||
@ -1303,11 +1303,11 @@ class ValueType : public Value {
|
||||
}
|
||||
// Inputs are not negative so convert them to unsigned.
|
||||
#if __cplusplus >= 201402L
|
||||
const auto a_u = std::make_unsigned_t<decltype(a)>(a);
|
||||
const auto b_u = std::make_unsigned_t<decltype(b)>(b);
|
||||
const auto a_u = static_cast<std::make_unsigned_t<decltype(a)>>(a);
|
||||
const auto b_u = static_cast<std::make_unsigned_t<decltype(b)>>(b);
|
||||
#else
|
||||
const auto a_u = typename std::make_unsigned<decltype(a)>::type(a);
|
||||
const auto b_u = typename std::make_unsigned<decltype(b)>::type(b);
|
||||
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);
|
||||
#endif
|
||||
if (imax < b_u || imax < a_u) {
|
||||
return 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user