Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r76145 - in branches/release: . boost boost/random/detail
From: dnljms_at_[hidden]
Date: 2011-12-24 14:05:17


Author: danieljames
Date: 2011-12-24 14:05:17 EST (Sat, 24 Dec 2011)
New Revision: 76145
URL: http://svn.boost.org/trac/boost/changeset/76145

Log:
Merge log2 constexpr fix for gcc.
Properties modified:
   branches/release/ (props changed)
   branches/release/boost/ (props changed)
Text files modified:
   branches/release/boost/random/detail/integer_log2.hpp | 21 +++++++++++++++++----
   1 files changed, 17 insertions(+), 4 deletions(-)

Modified: branches/release/boost/random/detail/integer_log2.hpp
==============================================================================
--- branches/release/boost/random/detail/integer_log2.hpp (original)
+++ branches/release/boost/random/detail/integer_log2.hpp 2011-12-24 14:05:17 EST (Sat, 24 Dec 2011)
@@ -35,13 +35,26 @@
 template<int Shift>
 struct integer_log2_impl
 {
+#if defined(BOOST_NO_CONSTEXPR)
     template<class T>
- BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum,
- int update = 0)
+ BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
+ {
+ int update = ((t >> Shift) != 0) * Shift;
+ return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
+ }
+#else
+ template<class T>
+ BOOST_RANDOM_DETAIL_CONSTEXPR static int apply2(T t, int accum, int update)
+ {
+ return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
+ }
+
+ template<class T>
+ BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
     {
- return update = ((t >> Shift) != 0) * Shift,
- integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
+ return apply2(t, accum, ((t >> Shift) != 0) * Shift);
     }
+#endif
 };
 
 template<>


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