Skip to content

Commit

Permalink
Fix math portability for xplat
Browse files Browse the repository at this point in the history
Summary:
xplat folly sync got blocked due to an error with missing ::remainderl
function.
Not really sure why this function is missing, for now ignore it.

Reviewed By: Orvid

Differential Revision: D15298056

fbshipit-source-id: 34035da5de826b55e28c79b8540aacd827e1ffdf
  • Loading branch information
ammubhave authored and facebook-github-bot committed May 10, 2019
1 parent 5c57c80 commit 82a5342
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions folly/portability/Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ constexpr long double nextafter(long double x, long double y) {
return __builtin_nextafterl(x, y);
}

constexpr float remainder(float x, float y) {
return __builtin_remainderf(x, y);
}

constexpr double remainder(double x, double y) {
return __builtin_remainder(x, y);
}

constexpr long double remainder(long double x, long double y) {
return __builtin_remainderl(x, y);
}

#else // __GNUC__

inline float nextafter(float x, float y) {
Expand All @@ -78,19 +66,25 @@ inline long double nextafter(long double x, long double y) {
return ::nextafterl(x, y);
}

inline float remainder(float x, float y) {
return ::remainderf(x, y);
}
#endif // __GNUC__

inline double remainder(double x, double y) {
return ::remainder(x, y);
/**
* On uclibc, std::remainder isn't implemented.
* Implement it using builtin versions
*/
#ifdef __UCLIBC__
constexpr float remainder(float x, float y) {
return __builtin_remainderf(x, y);
}

inline long double remainder(long double x, long double y) {
return ::remainderl(x, y);
constexpr double remainder(double x, double y) {
return __builtin_remainder(x, y);
}

#endif // __GNUC__
constexpr long double remainder(long double x, long double y) {
return __builtin_remainderl(x, y);
}
#endif // __UCLIBC__

#endif // !__ANDROID__ && !__UCLIBC__
} // namespace folly

0 comments on commit 82a5342

Please sign in to comment.