mirror of
https://github.com/boostorg/random.git
synced 2026-02-26 17:02:15 +00:00
Random: Merge constexpr integer_log2_impl.
[SVN r73268]
This commit is contained in:
@@ -22,9 +22,7 @@ namespace boost {
|
||||
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 @@ template<int Shift>
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user