diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 763d6e6..8b04fc8 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -1023,6 +1023,19 @@ static JS_ALWAYS_INLINE TargetType Convert(FromType d) return ConvertImpl::Convert(d); } +template +class no_bug_numeric_digits +{ + public: + static const int digits = numeric_limits::digits; +}; +template<> +class no_bug_numeric_digits +{ + public: + static const int digits = 64; +}; + template static JS_ALWAYS_INLINE bool IsAlwaysExact() { @@ -1035,7 +1048,7 @@ static JS_ALWAYS_INLINE bool IsAlwaysExact() // 2) If FromType is signed, TargetType must also be signed. (Floating point // types are always signed.) // 3) If TargetType is an exact integral type, FromType must be also. - if (numeric_limits::digits < numeric_limits::digits) + if (numeric_limits::digits < no_bug_numeric_digits::digits) return false; if (numeric_limits::is_signed &&