Modify

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

Attachments (0)

Change History (1)

comment:1 Changed 10 months ago by John Maddock

Milestone: To Be DeterminedBoost 1.64.0
Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Maddock.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.