Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52870 - trunk/libs/spirit/test/qi
From: hartmut.kaiser_at_[hidden]
Date: 2009-05-09 23:04:11


Author: hkaiser
Date: 2009-05-09 23:04:11 EDT (Sat, 09 May 2009)
New Revision: 52870
URL: http://svn.boost.org/trac/boost/changeset/52870

Log:
Spirit: Fixed static assertion in test qi/int.cpp on platforms where sizeof(long) == 8
Text files modified:
   trunk/libs/spirit/test/qi/int.cpp | 14 +++++++++++---
   1 files changed, 11 insertions(+), 3 deletions(-)

Modified: trunk/libs/spirit/test/qi/int.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/int.cpp (original)
+++ trunk/libs/spirit/test/qi/int.cpp 2009-05-09 23:04:11 EDT (Sat, 09 May 2009)
@@ -19,7 +19,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 //
 // *** BEWARE PLATFORM DEPENDENT!!! ***
-// *** The following assumes 32 bit integers and 64 bit long longs.
+// *** The following assumes 32 bit or 64 bit integers and 64 bit long longs.
 // *** Modify these constant strings when appropriate.
 //
 ///////////////////////////////////////////////////////////////////////////////
@@ -34,14 +34,22 @@
 # define LONG_LONG_MAX 0x7fffffffffffffffLL
 # define LONG_LONG_MIN (-LONG_LONG_MAX - 1)
 #endif
-#endif // BOOST_HAS_LONG_LONG
 
-BOOST_STATIC_ASSERT(sizeof(long) == 4);
+#endif // BOOST_HAS_LONG_LONG
 
+#if LONG_MAX != LLONG_MAX
+ BOOST_STATIC_ASSERT(sizeof(long) == 4);
     char const* max_int = "2147483647";
     char const* int_overflow = "2147483648";
     char const* min_int = "-2147483648";
     char const* int_underflow = "-2147483649";
+#else
+ BOOST_STATIC_ASSERT(sizeof(long) == 8);
+ char const* max_int = "9223372036854775807";
+ char const* int_overflow = "9223372036854775808";
+ char const* min_int = "-9223372036854775808";
+ char const* int_underflow = "-9223372036854775809";
+#endif
 
 #ifdef BOOST_HAS_LONG_LONG
     char const* max_long_long = "9223372036854775807";


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