Commit d702656f authored by hausmann@webkit.org's avatar hausmann@webkit.org

2008-11-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>

        Reviewed by Simon Hausmann.

        Borrow some math functions from the MSVC port to the build with the
        RVCT compiler.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38177 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c74cce9b
2008-11-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Simon Hausmann.
Borrow some math functions from the MSVC port to the build with the
RVCT compiler.
* wtf/MathExtras.h:
(isinf):
(isnan):
(signbit):
2008-11-06 Laszlo Gombos <laszlo.1.gombos@nokia.com> 2008-11-06 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Simon Hausmann. Reviewed by Simon Hausmann.
......
...@@ -100,17 +100,22 @@ inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x ...@@ -100,17 +100,22 @@ inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x
#endif #endif
#if COMPILER(MSVC) #if COMPILER(MSVC) || COMPILER(RVCT)
inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
inline bool isnan(double num) { return !!_isnan(num); }
inline long lround(double num) { return static_cast<long>(num > 0 ? num + 0.5 : ceil(num - 0.5)); } inline long lround(double num) { return static_cast<long>(num > 0 ? num + 0.5 : ceil(num - 0.5)); }
inline long lroundf(float num) { return static_cast<long>(num > 0 ? num + 0.5f : ceilf(num - 0.5f)); } inline long lroundf(float num) { return static_cast<long>(num > 0 ? num + 0.5f : ceilf(num - 0.5f)); }
inline double round(double num) { return num > 0 ? floor(num + 0.5) : ceil(num - 0.5); } inline double round(double num) { return num > 0 ? floor(num + 0.5) : ceil(num - 0.5); }
inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); } inline float roundf(float num) { return num > 0 ? floorf(num + 0.5f) : ceilf(num - 0.5f); }
inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); } inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
#endif
#if COMPILER(MSVC)
inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
inline bool isnan(double num) { return !!_isnan(num); }
inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
inline double nextafter(double x, double y) { return _nextafter(x, y); } inline double nextafter(double x, double y) { return _nextafter(x, y); }
inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; } inline float nextafterf(float x, float y) { return x > y ? x - FLT_EPSILON : x + FLT_EPSILON; }
......
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