diff options
Diffstat (limited to 'libstdc++-v3/include/std/istream')
-rw-r--r-- | libstdc++-v3/include/std/istream | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream index 58716ce..8476d62 100644 --- a/libstdc++-v3/include/std/istream +++ b/libstdc++-v3/include/std/istream @@ -225,6 +225,94 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return _M_extract(__f); } ///@} +#if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + __attribute__((__always_inline__)) + __istream_type& + operator>>(_Float16& __f) + { + float __flt; + __istream_type& __ret = _M_extract(__flt); + ios_base::iostate __err = ios_base::goodbit; + if (__flt < -__FLT16_MAX__) + { + __f = -__FLT16_MAX__; + __err = ios_base::failbit; + } + else if (__flt > __FLT16_MAX__) + { + __f = __FLT16_MAX__; + __err = ios_base::failbit; + } + else + __f = static_cast<_Float16>(__flt); + if (__err) + this->setstate(__err); + return __ret; + } +#endif + +#if defined(__STDCPP_FLOAT32_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + __attribute__((__always_inline__)) + __istream_type& + operator>>(_Float32& __f) + { + float __flt; + __istream_type& __ret = _M_extract(__flt); + __f = static_cast<_Float32> (__flt); + return __ret; + } +#endif + +#if defined(__STDCPP_FLOAT64_T__) && defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64) + __attribute__((__always_inline__)) + __istream_type& + operator>>(_Float64& __f) + { + double __dbl; + __istream_type& __ret = _M_extract(__dbl); + __f = static_cast<_Float64> (__dbl); + return __ret; + } +#endif + +#if defined(__STDCPP_FLOAT128_T__) && defined(_GLIBCXX_LDOUBLE_IS_IEEE_BINARY128) + __attribute__((__always_inline__)) + __istream_type& + operator>>(_Float128& __f) + { + long double __ldbl; + __istream_type& __ret = _M_extract(__ldbl); + __f = static_cast<_Float128> (__ldbl); + return __ret; + } +#endif + +#if defined(__STDCPP_BFLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) + __attribute__((__always_inline__)) + __istream_type& + operator>>(__gnu_cxx::__bfloat16_t & __f) + { + float __flt; + __istream_type& __ret = _M_extract(__flt); + ios_base::iostate __err = ios_base::goodbit; + if (__flt < -__BFLT16_MAX__) + { + __f = -__BFLT16_MAX__; + __err = ios_base::failbit; + } + else if (__flt > __BFLT16_MAX__) + { + __f = __BFLT16_MAX__; + __err = ios_base::failbit; + } + else + __f = static_cast<__gnu_cxx::__bfloat16_t>(__flt); + if (__err) + this->setstate(__err); + return __ret; + } +#endif + /** * @brief Basic arithmetic extractors * @param __p A variable of pointer type. |