Subject: [Boost-bugs] [Boost C++ Libraries] #12170: boost::multiprecision::export_bits throws on a negative cpp_int number
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-05-02 08:54:11
#12170: boost::multiprecision::export_bits throws on a negative cpp_int number
-------------------------------------------------+-------------------------
Reporter: Tassilo Glander <tassilo.glander@â¦> | Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component:
Version: Boost 1.60.0 | multiprecision
Keywords: export_bits cpp_int | Severity: Problem
-------------------------------------------------+-------------------------
When calling export_bits on a negative boost::multiprecision number based
on cpp_int, an exception is thrown from the internal method msb ("testing
individual bits in negative values is not supported").
boost::multiprecision::checked_int128_t i (-1); // use negative number
std::vector<unsigned char> v;
export_bits(i, std::back_inserter(v), 8); // throws
export_bits is designed to be used for data exchange, so must export valid
data.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12170> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC