libstdc++: Merge latest Ryu sources
authorPatrick Palka <ppalka@redhat.com>
Tue, 16 Nov 2021 17:23:27 +0000 (12:23 -0500)
committerPatrick Palka <ppalka@redhat.com>
Tue, 16 Nov 2021 17:23:27 +0000 (12:23 -0500)
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>
libstdc++-v3/src/c++17/ryu/MERGE
libstdc++-v3/src/c++17/ryu/d2s_intrinsics.h

index 0ea65ad..9035502 100644 (file)
@@ -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.
index bbac4df..e3206b5 100644 (file)
@@ -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;