Index: src/utils.h |
diff --git a/src/utils.h b/src/utils.h |
index 7831fa9fee6e14778f467c74498784b0c2f57e7b..d7967e7f0e20a49c4768ce9cedff3c5e9ad65581 100644 |
--- a/src/utils.h |
+++ b/src/utils.h |
@@ -8,6 +8,7 @@ |
#include <limits.h> |
#include <stdlib.h> |
#include <string.h> |
+#include <cmath> |
#include "include/v8.h" |
#include "src/allocation.h" |
@@ -140,6 +141,15 @@ T Abs(T a) { |
} |
+// Floor(-0.0) == 0.0 |
+inline double Floor(double x) { |
+#ifdef _MSC_VER |
+ if (x == 0) return x; // Fix for issue 3477. |
+#endif |
+ return std::floor(x); |
+} |
+ |
+ |
// TODO(svenpanne) Clean up the whole power-of-2 mess. |
inline int32_t WhichPowerOf2Abs(int32_t x) { |
return (x == kMinInt) ? 31 : WhichPowerOf2(Abs(x)); |