Commit ae2f0378 by Copybara-Service

Merge pull request #1387 from AtariDreams:patch-1

PiperOrigin-RevId: 509581648
Change-Id: Ia60053f1172e0e64569e9555524812fc4788e24f
parents d6a45e95 b7a8491f
...@@ -111,7 +111,7 @@ uint128 MakeUint128FromFloat(T v) { ...@@ -111,7 +111,7 @@ uint128 MakeUint128FromFloat(T v) {
return MakeUint128(0, static_cast<uint64_t>(v)); return MakeUint128(0, static_cast<uint64_t>(v));
} }
#if defined(__clang__) && !defined(__SSE3__) #if defined(__clang__) && (__clang_major__ < 9) && !defined(__SSE3__)
// Workaround for clang bug: https://bugs.llvm.org/show_bug.cgi?id=38289 // Workaround for clang bug: https://bugs.llvm.org/show_bug.cgi?id=38289
// Casting from long double to uint64_t is miscompiled and drops bits. // Casting from long double to uint64_t is miscompiled and drops bits.
// It is more work, so only use when we need the workaround. // It is more work, so only use when we need the workaround.
...@@ -131,7 +131,7 @@ uint128 MakeUint128FromFloat(long double v) { ...@@ -131,7 +131,7 @@ uint128 MakeUint128FromFloat(long double v) {
return (static_cast<uint128>(w0) << 100) | (static_cast<uint128>(w1) << 50) | return (static_cast<uint128>(w0) << 100) | (static_cast<uint128>(w1) << 50) |
static_cast<uint128>(w2); static_cast<uint128>(w2);
} }
#endif // __clang__ && !__SSE3__ #endif // __clang__ && (__clang_major__ < 9) && !__SSE3__
} // namespace } // namespace
uint128::uint128(float v) : uint128(MakeUint128FromFloat(v)) {} uint128::uint128(float v) : uint128(MakeUint128FromFloat(v)) {}
......
...@@ -1102,7 +1102,7 @@ void PrintExponent(int exp, char e, Buffer *out) { ...@@ -1102,7 +1102,7 @@ void PrintExponent(int exp, char e, Buffer *out) {
template <typename Float, typename Int> template <typename Float, typename Int>
constexpr bool CanFitMantissa() { constexpr bool CanFitMantissa() {
return return
#if defined(__clang__) && !defined(__SSE3__) #if defined(__clang__) && (__clang_major__ < 9) && !defined(__SSE3__)
// Workaround for clang bug: https://bugs.llvm.org/show_bug.cgi?id=38289 // Workaround for clang bug: https://bugs.llvm.org/show_bug.cgi?id=38289
// Casting from long double to uint64_t is miscompiled and drops bits. // Casting from long double to uint64_t is miscompiled and drops bits.
(!std::is_same<Float, long double>::value || (!std::is_same<Float, long double>::value ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment