Silence clang static analyzer complaint about potential div by 0.

It can't, because if b is 0 the function would have
returned already; since b.m_hi is 0 b.m_lo can't be. The assert
reassures clang that this is the case.
This commit is contained in:
John Ralls 2018-11-28 15:39:07 +09:00
parent 3d1362757b
commit 43a30e1c97

View File

@ -770,6 +770,7 @@ GncInt128::div (const GncInt128& b, GncInt128& q, GncInt128& r) const noexcept
q.m_hi = set_flags(hi, qflags);
if (hi == 0 && bhi == 0) //let the hardware do it
{
assert (b.m_lo != 0); // b.m_hi is 0 but b isn't or we didn't get here.
q.m_lo = m_lo / b.m_lo;
r.m_lo = m_lo % b.m_lo;
return;