diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index c169269698a..3243c649731 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -320,17 +320,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX14_CONSTEXPR unsigned long long _Base_bitset<_Nw>::_M_do_to_ullong() const { - const bool __dw = sizeof(unsigned long long) > sizeof(unsigned long); - for (size_t __i = 1 + __dw; __i < _Nw; ++__i) +#if __SIZEOF_LONG_LONG__ == __SIZEOF_LONG__ + return _M_do_to_ulong(); +#else + for (size_t __i = 2; __i < _Nw; ++__i) if (_M_w[__i]) __throw_overflow_error(__N("_Base_bitset::_M_do_to_ullong")); - if (__dw) - return _M_w[0] + (static_cast(_M_w[1]) + return _M_w[0] + (static_cast(_M_w[1]) << _GLIBCXX_BITSET_BITS_PER_WORD); - return _M_w[0]; - } #endif + } +#endif // C++11 template _GLIBCXX14_CONSTEXPR size_t