From ee35402244fc463cedc470baa0f5f1a6080d905d Mon Sep 17 00:00:00 2001 From: Karol Ostrovsky Date: Mon, 29 Jun 2015 16:13:33 +0200 Subject: MinGW64+MSYS2 compilation issues and portable isnan using MathLimits --- src/google/protobuf/stubs/strutil.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/google/protobuf/stubs/strutil.cc') diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc index 99e8bf1d..2ec62b42 100644 --- a/src/google/protobuf/stubs/strutil.cc +++ b/src/google/protobuf/stubs/strutil.cc @@ -31,6 +31,7 @@ // from google3/strings/strutil.cc #include +#include #include #include // FLT_DIG and DBL_DIG @@ -58,11 +59,6 @@ namespace google { namespace protobuf { -inline bool IsNaN(double value) { - // NaN is never equal to anything, even itself. - return value != value; -} - // These are defined as macros on some platforms. #undef them so that we can // redefine them. #undef isxdigit @@ -1210,7 +1206,7 @@ char* DoubleToBuffer(double value, char* buffer) { } else if (value == -numeric_limits::infinity()) { strcpy(buffer, "-inf"); return buffer; - } else if (IsNaN(value)) { + } else if (MathLimits::IsNaN(value)) { strcpy(buffer, "nan"); return buffer; } @@ -1328,7 +1324,7 @@ char* FloatToBuffer(float value, char* buffer) { } else if (value == -numeric_limits::infinity()) { strcpy(buffer, "-inf"); return buffer; - } else if (IsNaN(value)) { + } else if (MathLimits::IsNaN(value)) { strcpy(buffer, "nan"); return buffer; } -- cgit v1.2.3