|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85220 - trunk/boost/multiprecision/cpp_int
From: john_at_[hidden]
Date: 2013-08-06 04:30:33
Author: johnmaddock
Date: 2013-08-06 04:30:33 EDT (Tue, 06 Aug 2013)
New Revision: 85220
URL: http://svn.boost.org/trac/boost/changeset/85220
Log:
Fix deserialization when limb size is larger than that of the original archive.
Text files modified:
trunk/boost/multiprecision/cpp_int/serialize.hpp | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
Modified: trunk/boost/multiprecision/cpp_int/serialize.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/serialize.hpp Tue Aug 6 04:08:13 2013 (r85219)
+++ trunk/boost/multiprecision/cpp_int/serialize.hpp 2013-08-06 04:30:33 EDT (Tue, 06 Aug 2013) (r85220)
@@ -55,11 +55,12 @@
for(std::size_t i = 0; i < limb_count; ++i)
{
pl[i] = 0;
- for(std::size_t j = 0; j < sizeof(limb_type); ++j)
+ for(std::size_t j = 0; (j < sizeof(limb_type)) && byte_count; ++j)
{
unsigned char byte;
ar & byte;
pl[i] |= static_cast<limb_type>(byte) << (j * CHAR_BIT);
+ --byte_count;
}
}
if(s != val.sign())
@@ -99,9 +100,9 @@
bool s;
typename Int::local_limb_type l = 0;
ar & s;
- std::size_t limb_count;
- ar & limb_count;
- for(std::size_t i = 0; i < limb_count; ++i)
+ std::size_t byte_count;
+ ar & byte_count;
+ for(std::size_t i = 0; i < byte_count; ++i)
{
unsigned char b;
ar & b;
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