]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Simplify numeric_limits<__max_size_type>
authorJonathan Wakely <jwakely@redhat.com>
Fri, 16 Jul 2021 12:53:05 +0000 (13:53 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 16 Jul 2021 14:03:03 +0000 (15:03 +0100)
If __int128 is supported then __int_traits<__int128> is guaranteed to be
specialized, so we can remove the preprocessor condition inside the
std::numeric_traits<__detail::__max_size_type> specialization. Simply
using __int_traits<_Sp::__rep> gives the right answer.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/max_size_type.h (numeric_limits<__max_size_type>):
Use __int_traits unconditionally.

libstdc++-v3/include/bits/max_size_type.h

index 298a929db0360d1c51f01c2377e31ef002a5b369..11721b30b6178406a4337930ddbfdb60b1d34c9c 100644 (file)
@@ -771,14 +771,8 @@ namespace ranges
       static constexpr bool is_signed = false;
       static constexpr bool is_integer = true;
       static constexpr bool is_exact = true;
-#if __SIZEOF_INT128__
-      static_assert(__extension__ same_as<_Sp::__rep, __uint128_t>);
-      static constexpr int digits = 129;
-#else
-      static_assert(same_as<_Sp::__rep, unsigned long long>);
       static constexpr int digits
-       = __gnu_cxx::__int_traits<unsigned long long>::__digits + 1;
-#endif
+       = __gnu_cxx::__int_traits<_Sp::__rep>::__digits + 1;
       static constexpr int digits10
        = static_cast<int>(digits * numbers::ln2 / numbers::ln10);