Some smaller issues found by Covertiy Scan

This commit is contained in:
Alex Beregszaszi
2017-08-22 13:55:28 +01:00
parent f38429fef8
commit f2d6226718
4 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -739,18 +739,18 @@ bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const
{
if (_convertTo.category() == Category::Integer)
{
auto targetType = dynamic_cast<IntegerType const*>(&_convertTo);
if (m_value == rational(0))
return true;
if (isFractional())
return false;
int forSignBit = (targetType->isSigned() ? 1 : 0);
IntegerType const& targetType = dynamic_cast<IntegerType const&>(_convertTo);
int forSignBit = (targetType.isSigned() ? 1 : 0);
if (m_value > rational(0))
{
if (m_value.numerator() <= (u256(-1) >> (256 - targetType->numBits() + forSignBit)))
if (m_value.numerator() <= (u256(-1) >> (256 - targetType.numBits() + forSignBit)))
return true;
}
else if (targetType->isSigned() && -m_value.numerator() <= (u256(1) << (targetType->numBits() - forSignBit)))
else if (targetType.isSigned() && -m_value.numerator() <= (u256(1) << (targetType.numBits() - forSignBit)))
return true;
return false;
}