Opened 5 months ago

Closed 5 months 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: johnmaddock
Milestone: Boost 1.64.0 Component: multiprecision
Version: Boost 1.62.0 Severity: Problem
Keywords: Cc: mika.fischer@…


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 5 months ago by johnmaddock

  • Milestone changed from To Be Determined to Boost 1.64.0
  • Resolution set to fixed
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain johnmaddock.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.