Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: third_party/protobuf/src/google/protobuf/stubs/mathutil.h

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698