Opened 6 years ago

Closed 6 years ago

#12790 closed Bugs (fixed)

Left shift does not work on 32 bit Linux and MSVC 2015 (32 and 64 bits)

Reported by: mika.fischer@… Owned by: John Maddock
Milestone: Boost 1.64.0 Component: multiprecision
Version: Boost 1.62.0 Severity: Problem
Keywords: Cc: mika.fischer@…

Description

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;
}

Change History (1)

comment:1 by John Maddock, 6 years ago

Milestone: To Be DeterminedBoost 1.64.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.