Index: src/conversions.h |
diff --git a/src/conversions.h b/src/conversions.h |
index 70559c9e9d7979f449110793bbdde122cd1d99a5..10c074d4273fbcd792ddb365cb9a61edd67c0a55 100644 |
--- a/src/conversions.h |
+++ b/src/conversions.h |
@@ -64,6 +64,8 @@ inline double SignedZero(bool negative) { |
inline int FastD2I(double x) { |
// The static_cast convertion from double to int used to be slow, but |
Sven Panne
2012/07/30 06:21:46
I think this comment can be removed, it is totally
|
// as new benchmarks show, now it is much faster than lrint(). |
+ if (!(x >= INT_MIN)) return INT_MIN; // Negation to catch NaNs. |
+ if (x > INT_MAX) return INT_MAX; |
return static_cast<int>(x); |
} |