[llvm] r199052 - raw_stream formatter: [Win32] Use std::signbit() if available, instead of _fpclass().

NAKAMURA Takumi geek4civic at gmail.com
Sun Jan 12 06:44:46 PST 2014


Author: chapuni
Date: Sun Jan 12 08:44:46 2014
New Revision: 199052

URL: http://llvm.org/viewvc/llvm-project?rev=199052&view=rev
Log:
raw_stream formatter: [Win32] Use std::signbit() if available, instead of _fpclass().

FIXME: It should be generic to C++11. For now, it is dedicated to mingw-w64.

Modified:
    llvm/trunk/lib/Support/raw_ostream.cpp

Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=199052&r1=199051&r2=199052&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Sun Jan 12 08:44:46 2014
@@ -227,11 +227,17 @@ raw_ostream &raw_ostream::operator<<(dou
   // On MSVCRT and compatible, output of %e is incompatible to Posix
   // by default. Number of exponent digits should be at least 2. "%+03d"
   // FIXME: Implement our formatter to here or Support/Format.h!
+#if __cplusplus >= 201103L && defined(__MINGW32__)
+  // FIXME: It should be generic to C++11.
+  if (N == 0.0 && std::signbit(N))
+    return *this << "-0.000000e+00";
+#else
   int fpcl = _fpclass(N);
 
   // negative zero
   if (fpcl == _FPCLASS_NZ)
     return *this << "-0.000000e+00";
+#endif
 
   char buf[16];
   unsigned len;





More information about the llvm-commits mailing list