Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85354 - trunk/boost/multiprecision
From: john_at_[hidden]
Date: 2013-08-15 06:45:49


Author: johnmaddock
Date: 2013-08-15 06:45:49 EDT (Thu, 15 Aug 2013)
New Revision: 85354
URL: http://svn.boost.org/trac/boost/changeset/85354

Log:
Improve _Quad/__float128 selection logic.

Text files modified:
   trunk/boost/multiprecision/float128.hpp | 32 ++++++++++++++++++++++++++------
   1 files changed, 26 insertions(+), 6 deletions(-)

Modified: trunk/boost/multiprecision/float128.hpp
==============================================================================
--- trunk/boost/multiprecision/float128.hpp Thu Aug 15 06:02:25 2013 (r85353)
+++ trunk/boost/multiprecision/float128.hpp 2013-08-15 06:45:49 EDT (Thu, 15 Aug 2013) (r85354)
@@ -10,8 +10,30 @@
 #include <boost/scoped_array.hpp>
 #include <boost/multiprecision/number.hpp>
 
+#if defined(BOOST_INTEL) && !defined(BOOST_MP_USE_FLOAT128) && !defined(BOOST_MP_USE_QUAD)
+# if defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION >= 1310) && defined(__GNUC__)
+# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
+# define BOOST_MP_USE_FLOAT128
+# endif
+# endif
+
+# ifndef BOOST_MP_USE_FLOAT128
+# define BOOST_MP_USE_QUAD
+# endif
+#endif
+
+#if defined(__GNUC__) && !defined(BOOST_MP_USE_FLOAT128) && !defined(BOOST_MP_USE_QUAD)
+# define BOOST_MP_USE_FLOAT128
+#endif
+
+#if !defined(BOOST_MP_USE_FLOAT128) && !defined(BOOST_MP_USE_QUAD)
+# error "Sorry compiler is neither GCC, not Intel, don't know how to configure this header."
+#endif
+#if defined(BOOST_MP_USE_FLOAT128) && defined(BOOST_MP_USE_QUAD)
+# error "Oh dear, both BOOST_MP_USE_FLOAT128 and BOOST_MP_USE_QUAD are defined, which one should I be using?"
+#endif
 
-#if !defined(BOOST_INTEL) || (defined(BOOST_INTEL_CXX_VERSION) && (BOOST_INTEL_CXX_VERSION >= 1310) && defined(__GNUC__))
+#if defined(BOOST_MP_USE_FLOAT128)
 
 extern "C" {
 #include <quadmath.h>
@@ -19,9 +41,7 @@
 
 typedef __float128 float128_type;
 
-#else
-
-#define BOOST_MP_FLOAT128_IS_INTEL_QUAD
+#elif defined(BOOST_MP_USE_QUAD)
 
 #include <boost/multiprecision/detail/float_string_cvt.hpp>
 
@@ -134,7 +154,7 @@
    }
    float128_backend& operator = (const char* s)
    {
-#ifndef BOOST_MP_FLOAT128_IS_INTEL_QUAD
+#ifndef BOOST_MP_USE_QUAD
       char* p_end;
       m_value = strtoflt128(s, &p_end);
       if(p_end - s != (std::ptrdiff_t)std::strlen(s))
@@ -152,7 +172,7 @@
    }
    std::string str(std::streamsize digits, std::ios_base::fmtflags f)const
    {
-#ifndef BOOST_MP_FLOAT128_IS_INTEL_QUAD
+#ifndef BOOST_MP_USE_QUAD
       char buf[100];
       boost::scoped_array<char> buf2;
       std::string format = "%";


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk