Ticket #12790 (closed Bugs: fixed)

Opened 3 months ago

Last modified 3 months ago

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;


Change History

comment:1 Changed 3 months ago by johnmaddock

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

Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
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.