public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-5313] libstdc++: Merge latest Ryu sources
Date: Tue, 16 Nov 2021 17:23:51 +0000 (GMT)	[thread overview]
Message-ID: <20211116172351.DC9BA3858004@sourceware.org> (raw)

https://gcc.gnu.org/g:7461b5813126c6dbe11f0f9d06c1bd83b082111e

commit r12-5313-g7461b5813126c6dbe11f0f9d06c1bd83b082111e
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Nov 16 12:23:27 2021 -0500

    libstdc++: Merge latest Ryu sources
    
    libstdc++-v3/ChangeLog:
    
            * src/c++17/ryu/MERGE: Update the commit hash.
            * src/c++17/ryu/d2s_intrinsics.h: Merge from Ryu's master
            branch.
    
    Signed-off-by: Patrick Palka <ppalka@redhat.com>

Diff:
---
 libstdc++-v3/src/c++17/ryu/MERGE            | 2 +-
 libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/libstdc++-v3/src/c++17/ryu/MERGE b/libstdc++-v3/src/c++17/ryu/MERGE
index 0ea65add2ff..9035502846e 100644
--- a/libstdc++-v3/src/c++17/ryu/MERGE
+++ b/libstdc++-v3/src/c++17/ryu/MERGE
@@ -1,4 +1,4 @@
-22c887c017a8512abcd4a8f6bfcdb2742829cd7d
+150d0c87830756d34e76c42f7f33f811d89903a8
 
 The first line of this file holds the git revision number of the
 last merge done from the master library sources.
diff --git a/libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h b/libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h
index bbac4dfd48f..e3206b5d7dd 100644
--- a/libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h
+++ b/libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h
@@ -181,15 +181,14 @@ static inline uint32_t mod1e9(const uint64_t x) {
 #endif // defined(RYU_32_BIT_PLATFORM)
 
 static inline uint32_t pow5Factor(uint64_t value) {
+  const uint64_t m_inv_5 = 14757395258967641293u; // 5 * m_inv_5 = 1 (mod 2^64)
+  const uint64_t n_div_5 = 3689348814741910323u;  // #{ n | n = 0 (mod 2^64) } = 2^64 / 5
   uint32_t count = 0;
   for (;;) {
     assert(value != 0);
-    const uint64_t q = div5(value);
-    const uint32_t r = ((uint32_t) value) - 5 * ((uint32_t) q);
-    if (r != 0) {
+    value *= m_inv_5;
+    if (value > n_div_5)
       break;
-    }
-    value = q;
     ++count;
   }
   return count;


                 reply	other threads:[~2021-11-16 17:23 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=20211116172351.DC9BA3858004@sourceware.org \
    --to=ppalka@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).