[libcxx-commits] [PATCH] D99516: [libc++] Avoid <climits> dependency in <thread>

Joerg Sonnenberger via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Mar 31 06:29:43 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9f4022ffeb20: [libc++] Avoid <climits> dependency in <thread> (authored by joerg).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99516/new/

https://reviews.llvm.org/D99516

Files:
  libcxx/include/thread


Index: libcxx/include/thread
===================================================================
--- libcxx/include/thread
+++ libcxx/include/thread
@@ -362,12 +362,11 @@
 {
     if (__d > chrono::duration<_Rep, _Period>::zero())
     {
-#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__)
-    //  GCC's long double const folding is incomplete for IBM128 long doubles.
-        _LIBCPP_CONSTEXPR chrono::duration<long double> _Max = chrono::duration<long double>(ULLONG_MAX/1000000000ULL) ;
-#else
-        _LIBCPP_CONSTEXPR chrono::duration<long double> _Max = chrono::nanoseconds::max();
-#endif
+        // The standard guarantees a 64bit signed integer resolution for nanoseconds,
+        // so use INT64_MAX / 1e9 as cut-off point. Use a constant to avoid <climits>
+        // and issues with long double folding on PowerPC with GCC.
+        _LIBCPP_CONSTEXPR chrono::duration<long double> _Max =
+            chrono::duration<long double>(9223372036.0L);
         chrono::nanoseconds __ns;
         if (__d < _Max)
         {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99516.334426.patch
Type: text/x-patch
Size: 1050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210331/570ee97b/attachment.bin>


More information about the libcxx-commits mailing list