Fix carrying to the wrong end of the lower leg in left shift.

This commit is contained in:
John Ralls 2017-04-07 12:27:59 -07:00
parent e55b78614c
commit de1c56b53d

View File

@ -384,7 +384,7 @@ GncInt128::operator<<= (unsigned int i) noexcept
auto hi = get_num(m_hi);
if (i < legbits)
{
uint64_t carry {(m_lo & (((UINT64_C(1) << i) - 1) << (legbits - i)))};
uint64_t carry {(m_lo & (((UINT64_C(1) << i) - 1) << (legbits - i))) >> (legbits - i)};
m_lo <<= i;
hi <<= i;
hi += carry;