Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Unified Diff: Source/wtf/MathExtras.h

Issue 803763002: remove some pre vs2013 code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixup Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/MathExtras.h
diff --git a/Source/wtf/MathExtras.h b/Source/wtf/MathExtras.h
index e95702d2f18fa7431e0d8983580157763db794d6..835f9c986cfa7d8829e5ab4fe7aed68869e1b9b5 100644
--- a/Source/wtf/MathExtras.h
+++ b/Source/wtf/MathExtras.h
@@ -68,31 +68,6 @@ inline bool signbit(double x) { struct ieee_double *p = (struct ieee_double *)&x
#endif
-#if COMPILER(MSVC) && (_MSC_VER < 1800)
-
-// We must not do 'num + 0.5' or 'num - 0.5' because they can cause precision loss.
-static double round(double num)
-{
- double integer = ceil(num);
- if (num > 0)
- return integer - num > 0.5 ? integer - 1.0 : integer;
- return integer - num >= 0.5 ? integer - 1.0 : integer;
-}
-static float roundf(float num)
-{
- float integer = ceilf(num);
- if (num > 0)
- return integer - num > 0.5f ? integer - 1.0f : integer;
- return integer - num >= 0.5f ? integer - 1.0f : integer;
-}
-inline long long llround(double num) { return static_cast<long long>(round(num)); }
-inline long long llroundf(float num) { return static_cast<long long>(roundf(num)); }
-inline long lround(double num) { return static_cast<long>(round(num)); }
-inline long lroundf(float num) { return static_cast<long>(roundf(num)); }
-inline double trunc(double num) { return num > 0 ? floor(num) : ceil(num); }
-
-#endif
-
#if OS(ANDROID) || COMPILER(MSVC)
// ANDROID and MSVC's math.h does not currently supply log2 or log2f.
inline double log2(double num)
@@ -113,24 +88,6 @@ inline float log2f(float num)
// VS2013 has most of the math functions now, but we still need to work
// around various differences in behavior of Inf.
-#if _MSC_VER < 1800
-
-namespace std {
-
-inline bool isinf(double num) { return !_finite(num) && !_isnan(num); }
-inline bool isnan(double num) { return !!_isnan(num); }
-inline bool isfinite(double x) { return _finite(x); }
-inline bool signbit(double num) { return _copysign(1.0, num) < 0; }
-
-} // namespace std
-
-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 double copysign(double x, double y) { return _copysign(x, y); }
-
-#endif // _MSC_VER
-
// Work around a bug in Win, where atan2(+-infinity, +-infinity) yields NaN instead of specific values.
inline double wtf_atan2(double x, double y)
{
@@ -164,32 +121,6 @@ inline double wtf_pow(double x, double y) { return y == 0 ? 1 : pow(x, y); }
#define fmod(x, y) wtf_fmod(x, y)
#define pow(x, y) wtf_pow(x, y)
-#if _MSC_VER < 1800
-
-// MSVC's math functions do not bring lrint.
-inline long int lrint(double flt)
-{
- int64_t intgr;
-#if CPU(X86)
- __asm {
- fld flt
- fistp intgr
- };
-#else
- ASSERT(std::isfinite(flt));
- double rounded = round(flt);
- intgr = static_cast<int64_t>(rounded);
- // If the fractional part is exactly 0.5, we need to check whether
- // the rounded result is even. If it is not we need to add 1 to
- // negative values and subtract one from positive values.
- if ((fabs(intgr - flt) == 0.5) & intgr)
- intgr -= ((intgr >> 62) | 1); // 1 with the sign of result, i.e. -1 or 1.
-#endif
- return static_cast<long int>(intgr);
-}
-
-#endif // _MSC_VER
-
#endif // COMPILER(MSVC)
inline double deg2rad(double d) { return d * piDouble / 180.0; }
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698