Fix sizeof usage: fixes gcc-4.8.0 and clang failures.

[SVN r84220]
This commit is contained in:
John Maddock
2013-05-10 12:20:22 +00:00
parent 4a8d87954f
commit eede16de82
2 changed files with 7 additions and 7 deletions

View File

@@ -456,7 +456,7 @@ public:
#if defined(BOOST_MP_USER_DEFINED_LITERALS)
template <limb_type...VALUES>
BOOST_CONSTEXPR cpp_int_base(literals::detail::value_pack<VALUES...> i)
: m_wrapper(i), m_limbs(sizeof...VALUES), m_sign(false) {}
: m_wrapper(i), m_limbs(sizeof...(VALUES)), m_sign(false) {}
BOOST_CONSTEXPR cpp_int_base(literals::detail::value_pack<> i)
: m_wrapper(i), m_limbs(1), m_sign(false) {}
BOOST_CONSTEXPR cpp_int_base(const cpp_int_base& a, const literals::detail::negate_tag&)
@@ -604,7 +604,7 @@ public:
#if defined(BOOST_MP_USER_DEFINED_LITERALS)
template <limb_type...VALUES>
BOOST_CONSTEXPR cpp_int_base(literals::detail::value_pack<VALUES...> i)
: m_wrapper(i), m_limbs(sizeof...VALUES) {}
: m_wrapper(i), m_limbs(sizeof...(VALUES)) {}
BOOST_CONSTEXPR cpp_int_base(literals::detail::value_pack<>)
: m_wrapper(static_cast<limb_type>(0u)), m_limbs(1) {}
#endif

View File

@@ -48,7 +48,7 @@ template <char NextChar, char...CHARS>
struct pack_values
{
static constexpr unsigned chars_per_limb = sizeof(limb_type) * CHAR_BIT / 4;
static constexpr unsigned shift = ((sizeof...CHARS) % chars_per_limb) * 4;
static constexpr unsigned shift = ((sizeof...(CHARS)) % chars_per_limb) * 4;
static constexpr limb_type value_to_add = shift ? hex_value<NextChar>::value << shift : hex_value<NextChar>::value;
typedef typename pack_values<CHARS...>::type recursive_packed_type;
@@ -144,17 +144,17 @@ struct unsigned_cpp_int_literal_result_type
}
template <char... STR>
constexpr typename boost::multiprecision::literals::detail::signed_cpp_int_literal_result_type<(sizeof...STR) - 2>::number_type operator "" _cppi()
constexpr typename boost::multiprecision::literals::detail::signed_cpp_int_literal_result_type<(sizeof...(STR)) - 2>::number_type operator "" _cppi()
{
typedef typename boost::multiprecision::literals::detail::make_packed_value_from_str<STR...>::type pt;
return boost::multiprecision::literals::detail::make_backend_from_pack<pt, typename boost::multiprecision::literals::detail::signed_cpp_int_literal_result_type<(sizeof...STR) - 2>::backend_type>::value;
return boost::multiprecision::literals::detail::make_backend_from_pack<pt, typename boost::multiprecision::literals::detail::signed_cpp_int_literal_result_type<(sizeof...(STR)) - 2>::backend_type>::value;
}
template <char... STR>
constexpr typename boost::multiprecision::literals::detail::unsigned_cpp_int_literal_result_type<(sizeof...STR) - 2>::number_type operator "" _cppui()
constexpr typename boost::multiprecision::literals::detail::unsigned_cpp_int_literal_result_type<(sizeof...(STR)) - 2>::number_type operator "" _cppui()
{
typedef typename boost::multiprecision::literals::detail::make_packed_value_from_str<STR...>::type pt;
return boost::multiprecision::literals::detail::make_backend_from_pack<pt, typename boost::multiprecision::literals::detail::unsigned_cpp_int_literal_result_type<(sizeof...STR) - 2>::backend_type>::value;
return boost::multiprecision::literals::detail::make_backend_from_pack<pt, typename boost::multiprecision::literals::detail::unsigned_cpp_int_literal_result_type<(sizeof...(STR)) - 2>::backend_type>::value;
}
#define BOOST_MP_DEFINE_SIZED_CPP_INT_LITERAL(Bits)\