Skip to content

Instantly share code, notes, and snippets.

@iains
Created January 26, 2017 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iains/3b2e074d65263cd4be456c36839823d1 to your computer and use it in GitHub Desktop.
Save iains/3b2e074d65263cd4be456c36839823d1 to your computer and use it in GitHub Desktop.
work-around for missing long double const expressions on GCC/PPC
From: Iain Sandoe <iain@codesourcery.com>
Date: Sat, 11 Apr 2015 19:58:48 +0100
Subject: [PATCH] Fix up thread constexpr for GCC where the PPC port can't do
long long constexpr.
---
libcxx/include/thread | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libcxx/include/thread b/libcxx/include/thread
index 022021c..7a4d692 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -443,7 +443,13 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d)
using namespace chrono;
if (__d > duration<_Rep, _Period>::zero())
{
+#if ! defined (__clang__) && __APPLE__ && (__ppc__ || __ppc64__)
+ // We can't test for __GNUC__ since clang also defines that.
+ _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ;
+ //nanoseconds::max(); .. long double const folding is broken :(
+#else
_LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
+#endif
nanoseconds __ns;
if (__d < _Max)
{
--
2.8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment