* Hopefully fix int64_t to int32_t conversion errors.
* Allow proper Duration::rep type to propagate via template argument deduction
This commit is contained in:
parent
57d35cc6e6
commit
863d2ffc57
@ -1319,20 +1319,20 @@ inline bool isfinite(T) {
|
||||
}
|
||||
|
||||
// Converts value to int and checks that it's in the range [0, upper).
|
||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
inline std::intmax_t to_nonnegative_int(T value, std::intmax_t upper) {
|
||||
template <typename T, typename Int, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
inline Int to_nonnegative_int(T value, Int upper) {
|
||||
FMT_ASSERT(value >= 0 && to_unsigned(value) <= to_unsigned(upper),
|
||||
"invalid value");
|
||||
(void)upper;
|
||||
return static_cast<std::intmax_t>(value);
|
||||
return static_cast<Int>(value);
|
||||
}
|
||||
template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||
inline std::intmax_t to_nonnegative_int(T value, std::intmax_t upper) {
|
||||
template <typename T, typename Int, FMT_ENABLE_IF(!std::is_integral<T>::value)>
|
||||
inline Int to_nonnegative_int(T value, Int upper) {
|
||||
FMT_ASSERT(
|
||||
std::isnan(value) || (value >= 0 && value <= static_cast<T>(upper)),
|
||||
"invalid value");
|
||||
(void)upper;
|
||||
return static_cast<std::intmax_t>(value);
|
||||
return static_cast<Int>(value);
|
||||
}
|
||||
|
||||
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user