public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Simplify numeric_limits<__max_size_type>
Date: Fri, 16 Jul 2021 15:37:00 +0100	[thread overview]
Message-ID: <YPGZjC52ae/ENQAP@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

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.

Tested powerpc64le-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1573 bytes --]

commit bfb0586ebdb696efa9e59cb8da1d977c5880653b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jul 16 13:53:05 2021

    libstdc++: Simplify numeric_limits<__max_size_type>
    
    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.

diff --git a/libstdc++-v3/include/bits/max_size_type.h b/libstdc++-v3/include/bits/max_size_type.h
index 298a929db03..11721b30b61 100644
--- a/libstdc++-v3/include/bits/max_size_type.h
+++ b/libstdc++-v3/include/bits/max_size_type.h
@@ -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);
 

                 reply	other threads:[~2021-07-16 14:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YPGZjC52ae/ENQAP@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).