Index: third_party/protobuf/src/google/protobuf/stubs/mathutil.h |
diff --git a/third_party/protobuf/src/google/protobuf/stubs/mathutil.h b/third_party/protobuf/src/google/protobuf/stubs/mathutil.h |
index 8a9f69a0b225164b9749d4add91565428ddcd5fd..27956a8ea02f77b98c6c1bfbe98006fb5a7358e9 100644 |
--- a/third_party/protobuf/src/google/protobuf/stubs/mathutil.h |
+++ b/third_party/protobuf/src/google/protobuf/stubs/mathutil.h |
@@ -41,6 +41,27 @@ namespace google { |
namespace protobuf { |
namespace internal { |
template<typename T> |
+bool IsNan(T value) { |
+ return false; |
+} |
+template<> |
+inline bool IsNan(float value) { |
+#ifdef _MSC_VER |
+ return _isnan(value); |
+#else |
+ return isnan(value); |
+#endif |
+} |
+template<> |
+inline bool IsNan(double value) { |
+#ifdef _MSC_VER |
+ return _isnan(value); |
+#else |
+ return isnan(value); |
+#endif |
+} |
+ |
+template<typename T> |
bool AlmostEquals(T a, T b) { |
return a == b; |
} |
@@ -59,7 +80,7 @@ class MathUtil { |
public: |
template<typename T> |
static T Sign(T value) { |
- if (value == T(0) || MathLimits<T>::IsNaN(value)) { |
+ if (value == T(0) || ::google::protobuf::internal::IsNan<T>(value)) { |
return value; |
} |
return value > T(0) ? 1 : -1; |