From fe3eac52bfb050e3751edb045e6dd4fa52645bd8 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 2 Dec 2016 17:57:35 +0000 Subject: [PATCH] Fix bit exporting of trivial cpp_ints. Fixes: https://svn.boost.org/trac/boost/ticket/12627. --- include/boost/multiprecision/cpp_int/import_export.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/multiprecision/cpp_int/import_export.hpp b/include/boost/multiprecision/cpp_int/import_export.hpp index 3ba3442d..7bd843fb 100644 --- a/include/boost/multiprecision/cpp_int/import_export.hpp +++ b/include/boost/multiprecision/cpp_int/import_export.hpp @@ -199,8 +199,8 @@ namespace boost { template 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::digits ? ~static_cast(0) : (static_cast(1u) << count) - 1; + typename Backend::local_limb_type result = *val.limbs(); + typename Backend::local_limb_type mask = count >= std::numeric_limits::digits ? ~static_cast(0) : (static_cast(1u) << count) - 1; return (result >> location) & mask; }