diff options
author | 2020-06-13 15:58:27 +0200 | |
---|---|---|
committer | 2020-06-13 15:58:27 +0200 | |
commit | 284f196df1c65a91eb38a5a9f31a2da7fb86a1ac (patch) | |
tree | d29473e4024dce305d0ee3bb957a663420417312 /src/lib/netlist/plib/pstonum.h | |
parent | 52b8d5fd2b656c317e589da93467c33be74e76ea (diff) | |
parent | e949e9c29de82ee7c32692e7b65da05dd22bdc9d (diff) |
Merge branch 'master' of https://github.com/mamedev/mame
Diffstat (limited to 'src/lib/netlist/plib/pstonum.h')
-rw-r--r-- | src/lib/netlist/plib/pstonum.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/netlist/plib/pstonum.h b/src/lib/netlist/plib/pstonum.h index 630dee68422..c4bf692d177 100644 --- a/src/lib/netlist/plib/pstonum.h +++ b/src/lib/netlist/plib/pstonum.h @@ -10,6 +10,7 @@ #include "pconfig.h" #include "pexception.h" +#include "pgsl.h" #include "pmath.h" // for pstonum #include "pstring.h" @@ -36,9 +37,9 @@ namespace plib if (ss >> x) { auto pos(ss.tellg()); - if (pos == static_cast<decltype(pos)>(-1)) + if (pos == decltype(pos)(-1)) pos = len; - *idx = static_cast<std::size_t>(pos); + *idx = narrow_cast<std::size_t>(pos); } else *idx = constants<std::size_t>::zero(); @@ -88,7 +89,7 @@ namespace plib template <typename S> FLOAT128 operator()(std::locale loc, const S &arg, std::size_t *idx) { - return static_cast<FLOAT128>(pstonum_locale<long double>(loc, arg, idx)); + return narrow_cast<FLOAT128>(pstonum_locale<long double>(loc, arg, idx)); } }; #endif @@ -100,8 +101,8 @@ namespace plib std::size_t idx(0); auto ret = pstonum_helper<T>()(loc, cstr, &idx); using ret_type = decltype(ret); - if (ret >= static_cast<ret_type>(plib::numeric_limits<T>::lowest()) - && ret <= static_cast<ret_type>(plib::numeric_limits<T>::max())) + if (ret >= narrow_cast<ret_type>(plib::numeric_limits<T>::lowest()) + && ret <= narrow_cast<ret_type>(plib::numeric_limits<T>::max())) { if (cstr[idx] != 0) throw pexception(pstring("Continuation after numeric value ends: ") + pstring(cstr)); @@ -110,7 +111,7 @@ namespace plib { throw pexception(pstring("Out of range: ") + pstring(cstr)); } - return static_cast<T>(ret); + return narrow_cast<T>(ret); } template<typename R, typename T> |