Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72991 - trunk/boost/random/detail
From: dnljms_at_[hidden]
Date: 2011-07-09 13:14:00


Author: danieljames
Date: 2011-07-09 13:13:59 EDT (Sat, 09 Jul 2011)
New Revision: 72991
URL: http://svn.boost.org/trac/boost/changeset/72991

Log:
Random: fix constexpr in integer_log2_impl.
Text files modified:
   trunk/boost/random/detail/integer_log2.hpp | 11 +++++------
   1 files changed, 5 insertions(+), 6 deletions(-)

Modified: trunk/boost/random/detail/integer_log2.hpp
==============================================================================
--- trunk/boost/random/detail/integer_log2.hpp (original)
+++ trunk/boost/random/detail/integer_log2.hpp 2011-07-09 13:13:59 EDT (Sat, 09 Jul 2011)
@@ -22,9 +22,7 @@
 namespace random {
 namespace detail {
 
-// Daniel James: Disabled use of constexpr because integer_log2_impl is not a
-// valid constexpr.
-#if 0 && !defined(BOOST_NO_CONSTEXPR)
+#if !defined(BOOST_NO_CONSTEXPR)
 #define BOOST_RANDOM_DETAIL_CONSTEXPR constexpr
 #elif defined(BOOST_MSVC)
 #define BOOST_RANDOM_DETAIL_CONSTEXPR __forceinline
@@ -38,10 +36,11 @@
 struct integer_log2_impl
 {
     template<class T>
- BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
+ BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum,
+ int update = 0)
     {
- int update = ((t >> Shift) != 0) * Shift;
- return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
+ return update = ((t >> Shift) != 0) * Shift,
+ integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
     }
 };
 


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