You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.0 KiB

  1. diff --git a/folly/CachelinePadded.h b/folly/CachelinePadded.h
  2. --- a/folly/CachelinePadded.h
  3. +++ b/folly/CachelinePadded.h
  4. @@ -35,10 +35,6 @@
  5. */
  6. template <typename T>
  7. class CachelinePadded {
  8. - static_assert(
  9. - alignof(T) <= max_align_v,
  10. - "CachelinePadded does not support over-aligned types.");
  11. -
  12. public:
  13. template <typename... Args>
  14. explicit CachelinePadded(Args&&... args)
  15. diff --git a/folly/experimental/JSONSchema.cpp b/folly/experimental/JSONSchema.cpp
  16. --- a/folly/experimental/JSONSchema.cpp
  17. +++ b/folly/experimental/JSONSchema.cpp
  18. @@ -25,6 +25,7 @@
  19. #include <folly/Singleton.h>
  20. #include <folly/String.h>
  21. #include <folly/json.h>
  22. +#include <folly/portability/Math.h>
  23. namespace folly {
  24. namespace jsonschema {
  25. @@ -141,7 +142,7 @@
  26. return none;
  27. }
  28. if (schema_.isDouble() || value.isDouble()) {
  29. - const auto rem = std::remainder(value.asDouble(), schema_.asDouble());
  30. + const auto rem = folly::remainder(value.asDouble(), schema_.asDouble());
  31. if (std::abs(rem) > std::numeric_limits<double>::epsilon()) {
  32. return makeError("a multiple of ", schema_, value);
  33. }
  34. diff --git a/folly/external/farmhash/farmhash.cpp b/folly/external/farmhash/farmhash.cpp
  35. --- a/folly/external/farmhash/farmhash.cpp
  36. +++ b/folly/external/farmhash/farmhash.cpp
  37. @@ -181,6 +181,7 @@
  38. #undef bswap_32
  39. #undef bswap_64
  40. +#undef _BYTESWAP_H
  41. #include <byteswap.h>
  42. #endif
  43. diff --git a/folly/portability/Math.h b/folly/portability/Math.h
  44. --- a/folly/portability/Math.h
  45. +++ b/folly/portability/Math.h
  46. @@ -20,21 +20,24 @@
  47. namespace folly {
  48. -#ifndef __ANDROID__
  49. +#if !defined(__ANDROID__) && !defined(__UCLIBC__)
  50. /**
  51. - * Most platforms hopefully provide std::nextafter.
  52. + * Most platforms hopefully provide std::{nextafter,remainder}.
  53. */
  54. /* using override */ using std::nextafter;
  55. +/* using override */ using std::remainder;
  56. -#else // !__ANDROID__
  57. +#else // !__ANDROID__ && !__UCLIBC__
  58. /**
  59. * On Android, std::nextafter isn't implemented. However, the C functions and
  60. * compiler builtins are still provided. Using the GCC builtin is actually
  61. * slightly faster, as they're constexpr and the use cases within folly are in
  62. * constexpr context.
  63. + *
  64. + * UCLIBC doesn't implement std::remainder. Use the builtin versions.
  65. */
  66. #if defined(__GNUC__) && !defined(__clang__)
  67. @@ -51,6 +54,18 @@
  68. return __builtin_nextafterl(x, y);
  69. }
  70. +constexpr float remainder(float x, float y) {
  71. + return __builtin_remainderf(x, y);
  72. +}
  73. +
  74. +constexpr double remainder(double x, double y) {
  75. + return __builtin_remainder(x, y);
  76. +}
  77. +
  78. +constexpr long double remainder(long double x, long double y) {
  79. + return __builtin_remainderl(x, y);
  80. +}
  81. +
  82. #else // __GNUC__
  83. inline float nextafter(float x, float y) {
  84. @@ -65,6 +80,18 @@
  85. return ::nextafterl(x, y);
  86. }
  87. +inline float remainder(float x, float y) {
  88. + return ::remainderf(x, y);
  89. +}
  90. +
  91. +inline double remainder(double x, double y) {
  92. + return ::remainder(x, y);
  93. +}
  94. +
  95. +inline long double remainder(long double x, long double y) {
  96. + return ::remainderl(x, y);
  97. +}
  98. +
  99. #endif // __GNUC__
  100. #endif // __ANDROID__