Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84107 - trunk/boost/multiprecision/cpp_int
From: john_at_[hidden]
Date: 2013-05-02 07:50:46


Author: johnmaddock
Date: 2013-05-02 07:50:46 EDT (Thu, 02 May 2013)
New Revision: 84107
URL: http://svn.boost.org/trac/boost/changeset/84107

Log:
Fix undefined behaviour.
Text files modified:
   trunk/boost/multiprecision/cpp_int/bitwise.hpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: trunk/boost/multiprecision/cpp_int/bitwise.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_int/bitwise.hpp (original)
+++ trunk/boost/multiprecision/cpp_int/bitwise.hpp 2013-05-02 07:50:46 EDT (Thu, 02 May 2013)
@@ -366,7 +366,7 @@
    eval_right_shift(cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>& result, T s) BOOST_NOEXCEPT_IF((is_non_throwing_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value))
 {
    // Nothing to check here... just make sure we don't invoke undefined behavior:
- *result.limbs() = (static_cast<unsigned>(s) >= sizeof(*result.limbs()) * CHAR_BIT) ? 0 : *result.limbs() >>= s;
+ *result.limbs() = (static_cast<unsigned>(s) >= sizeof(*result.limbs()) * CHAR_BIT) ? 0 : *result.limbs() >> s;
 }
 
 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, unsigned MinBits2, unsigned MaxBits2, cpp_integer_type SignType2, cpp_int_check_type Checked2, class Allocator2>


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