Fix mask error in operator<<= and operator>>=

Must specify 1 as a uint64_t to get the right masks.
This commit is contained in:
John Ralls 2014-11-19 10:35:34 -08:00
parent 7c22669a76
commit 765d5583c1

View File

@ -246,7 +246,7 @@ QofInt128::operator<<= (uint i) noexcept
m_lo = 0;
return *this;
}
uint64_t carry {(m_lo & (((1 << i) - 1) << (legbits - i)))};
uint64_t carry {(m_lo & (((UINT64_C(1) << i) - 1) << (legbits - i)))};
m_lo <<= i;
m_hi <<= i;
m_hi += carry;
@ -263,7 +263,7 @@ QofInt128::operator>>= (uint i) noexcept
m_lo = 0;
return *this;
}
uint64_t carry {(m_hi & ((1 << i) - 1))};
uint64_t carry {(m_hi & ((UINT64_C(1) << i) - 1))};
m_lo >>= i;
m_hi >>= i;
m_lo += (carry << (legbits - i));