Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84928 - trunk/boost/multiprecision
From: john_at_[hidden]
Date: 2013-07-01 14:14:14


Author: johnmaddock
Date: 2013-07-01 14:14:14 EDT (Mon, 01 Jul 2013)
New Revision: 84928
URL: http://svn.boost.org/trac/boost/changeset/84928

Log:
Correct output of small-integer types.
Fixes #8745.

Text files modified:
   trunk/boost/multiprecision/cpp_int.hpp | 3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)

Modified: trunk/boost/multiprecision/cpp_int.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int.hpp Mon Jul 1 13:19:17 2013 (r84927)
+++ trunk/boost/multiprecision/cpp_int.hpp 2013-07-01 14:14:14 EDT (Mon, 01 Jul 2013) (r84928)
@@ -1427,11 +1427,12 @@
 private:
    std::string do_get_trivial_string(std::ios_base::fmtflags f, const mpl::false_&)const
    {
+ typedef typename mpl::if_c<sizeof(*this->limbs()) == 1, unsigned, typename base_type::local_limb_type>::type io_type;
       if(this->sign() && (((f & std::ios_base::hex) == std::ios_base::hex) || ((f & std::ios_base::oct) == std::ios_base::oct)))
          BOOST_THROW_EXCEPTION(std::runtime_error("Base 8 or 16 printing of negative numbers is not supported."));
       std::stringstream ss;
       ss.flags(f & ~std::ios_base::showpos);
- ss << *this->limbs();
+ ss << static_cast<io_type>(*this->limbs());
       std::string result;
       if(this->sign())
          result += '-';


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