2
0

0002-llvm-disable-int1280-math.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132
  1. diff --git a/thirdparty/clipper2/include/clipper2/clipper.core.h b/thirdparty/clipper2/include/clipper2/clipper.core.h
  2. index 67dd731af6..dd1b873d5d 100644
  3. --- a/thirdparty/clipper2/include/clipper2/clipper.core.h
  4. +++ b/thirdparty/clipper2/include/clipper2/clipper.core.h
  5. @@ -695,11 +695,13 @@ namespace Clipper2Lib
  6. // returns true if (and only if) a * b == c * d
  7. inline bool ProductsAreEqual(int64_t a, int64_t b, int64_t c, int64_t d)
  8. {
  9. -#if (defined(__clang__) || defined(__GNUC__)) && UINTPTR_MAX >= UINT64_MAX
  10. - const auto ab = static_cast<__int128_t>(a) * static_cast<__int128_t>(b);
  11. - const auto cd = static_cast<__int128_t>(c) * static_cast<__int128_t>(d);
  12. - return ab == cd;
  13. -#else
  14. +// Work around LLVM issue: https://github.com/llvm/llvm-project/issues/16778
  15. +// Details: https://github.com/godotengine/godot/pull/95964#issuecomment-2306581804
  16. +//#if (defined(__clang__) || defined(__GNUC__)) && UINTPTR_MAX >= UINT64_MAX
  17. +// const auto ab = static_cast<__int128_t>(a) * static_cast<__int128_t>(b);
  18. +// const auto cd = static_cast<__int128_t>(c) * static_cast<__int128_t>(d);
  19. +// return ab == cd;
  20. +//#else
  21. // nb: unsigned values needed for calculating overflow carry
  22. const auto abs_a = static_cast<uint64_t>(std::abs(a));
  23. const auto abs_b = static_cast<uint64_t>(std::abs(b));
  24. @@ -714,7 +716,7 @@ namespace Clipper2Lib
  25. const auto sign_cd = TriSign(c) * TriSign(d);
  26. return abs_ab == abs_cd && sign_ab == sign_cd;
  27. -#endif
  28. +// #endif
  29. }
  30. template <typename T>