|
|
@ -1270,7 +1270,7 @@ class ValueType : public Value {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check for integer overflow.
|
|
|
|
// Check for integer overflow.
|
|
|
|
#if __cplusplus >= 201703L
|
|
|
|
#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L
|
|
|
|
if constexpr (std::is_signed_v<I> == std::is_signed_v<decltype(a)>) {
|
|
|
|
if constexpr (std::is_signed_v<I> == std::is_signed_v<decltype(a)>) {
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
if (std::is_signed<I>::value == std::is_signed<decltype(a)>::value) {
|
|
|
|
if (std::is_signed<I>::value == std::is_signed<decltype(a)>::value) {
|
|
|
@ -1281,13 +1281,13 @@ class ValueType : public Value {
|
|
|
|
if (imax < b || a < imin || imax < a) {
|
|
|
|
if (imax < b || a < imin || imax < a) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#if __cplusplus >= 201703L
|
|
|
|
#if __cplusplus >= 201703L || _MSVC_LANG >= 201703L
|
|
|
|
} else if constexpr (std::is_signed_v<I>) {
|
|
|
|
} else if constexpr (std::is_signed_v<I>) {
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
} else if (std::is_signed<I>::value) {
|
|
|
|
} else if (std::is_signed<I>::value) {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
// conversion is from unsigned to signed
|
|
|
|
// conversion is from unsigned to signed
|
|
|
|
#if __cplusplus >= 201402L
|
|
|
|
#if __cplusplus >= 201402L || _MSVC_LANG >= 201402L
|
|
|
|
const auto imax = static_cast<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
|
|
|
|
#else
|
|
|
|
const auto imax = static_cast<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());
|
|
|
@ -1302,7 +1302,7 @@ class ValueType : public Value {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Inputs are not negative so convert them to unsigned.
|
|
|
|
// Inputs are not negative so convert them to unsigned.
|
|
|
|
#if __cplusplus >= 201402L
|
|
|
|
#if __cplusplus >= 201402L || _MSVC_LANG >= 201402L
|
|
|
|
const auto a_u = static_cast<std::make_unsigned_t<decltype(a)>>(a);
|
|
|
|
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);
|
|
|
|
const auto b_u = static_cast<std::make_unsigned_t<decltype(b)>>(b);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|