Fix bit exporting of trivial cpp_ints.

Fixes: https://svn.boost.org/trac/boost/ticket/12627.
This commit is contained in:
jzmaddock
2016-12-02 17:57:35 +00:00
parent 26ceb6ef38
commit fe3eac52bf

View File

@@ -199,8 +199,8 @@ namespace boost {
template <class Backend>
inline boost::uintmax_t extract_bits(const Backend& val, unsigned location, unsigned count, const mpl::true_&)
{
boost::uintmax_t result = *val.limbs();
boost::uintmax_t mask = count == std::numeric_limits<boost::uintmax_t>::digits ? ~static_cast<boost::uintmax_t>(0) : (static_cast<boost::uintmax_t>(1u) << count) - 1;
typename Backend::local_limb_type result = *val.limbs();
typename Backend::local_limb_type mask = count >= std::numeric_limits<typename Backend::local_limb_type>::digits ? ~static_cast<typename Backend::local_limb_type>(0) : (static_cast<typename Backend::local_limb_type>(1u) << count) - 1;
return (result >> location) & mask;
}