summaryrefslogtreecommitdiff
path: root/deps/v8/src/conversions.h
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-09-18 15:20:38 -0700
committerBert Belder <bertbelder@gmail.com>2012-09-21 01:52:24 +0200
commit3411a03dd114d635800cc50749d2351cd734eb2a (patch)
tree0ba1e52ab2236286894b33400302181ece91b63a /deps/v8/src/conversions.h
parentcc1b09d6b7c3cc6b8729804cbf644634ba5d0815 (diff)
downloadnode-new-3411a03dd114d635800cc50749d2351cd734eb2a.tar.gz
V8: Upgrade to 3.13.7.1
Diffstat (limited to 'deps/v8/src/conversions.h')
-rw-r--r--deps/v8/src/conversions.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/deps/v8/src/conversions.h b/deps/v8/src/conversions.h
index 70559c9e9d..1fbb5f1182 100644
--- a/deps/v8/src/conversions.h
+++ b/deps/v8/src/conversions.h
@@ -52,8 +52,13 @@ inline bool isDigit(int x, int radix) {
}
-inline double SignedZero(bool negative) {
- return negative ? -0.0 : 0.0;
+// The fast double-to-(unsigned-)int conversion routine does not guarantee
+// rounding towards zero.
+// For NaN and values outside the int range, return INT_MIN or INT_MAX.
+inline int FastD2IChecked(double x) {
+ if (!(x >= INT_MIN)) return INT_MIN; // Negation to catch NaNs.
+ if (x > INT_MAX) return INT_MAX;
+ return static_cast<int>(x);
}
@@ -62,8 +67,6 @@ inline double SignedZero(bool negative) {
// The result is unspecified if x is infinite or NaN, or if the rounded
// integer value is outside the range of type int.
inline int FastD2I(double x) {
- // The static_cast convertion from double to int used to be slow, but
- // as new benchmarks show, now it is much faster than lrint().
return static_cast<int>(x);
}