[Boost-bugs] [Boost C++ Libraries] #12790: Left shift does not work on 32 bit Linux and MSVC 2015 (32 and 64 bits)

Subject: [Boost-bugs] [Boost C++ Libraries] #12790: Left shift does not work on 32 bit Linux and MSVC 2015 (32 and 64 bits)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-01-25 16:06:03


#12790: Left shift does not work on 32 bit Linux and MSVC 2015 (32 and 64 bits)
------------------------------+----------------------------
 Reporter: mika.fischer@… | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
  Version: Boost 1.62.0 | Severity: Problem
 Keywords: |
------------------------------+----------------------------
 The following test program creates an unsigned 160 bit unsigned integer
 with all bits set and shifts it by six bits to the left.

 On 64 bit Linux, the expected result (F...FC0) is returned. But on 32 bit
 Linux and MSVC 2015 (32 bit as well as 64 bit), the incorrect result
 (F...FC000000000) is returned.

 {{{
 #include <boost/multiprecision/cpp_int.hpp>

 namespace mp = boost::multiprecision;
 using namespace std;

 typedef mp::number<mp::cpp_int_backend<20*8, 20*8, mp::unsigned_magnitude,
 mp::unchecked, void> > number_t;

 int main()
 {
     number_t n = -1;
     cout << hex << n << endl;
     n = n << 6;
     cout << hex << n << endl;
 }

 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12790>
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