mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fixed assigning negative number to unsigned
This commit is contained in:
parent
89aab7e234
commit
4e15a39107
@ -371,7 +371,7 @@ bool IntegerConstantType::isImplicitlyConvertibleTo(Type const& _convertTo) cons
|
||||
if (m_value <= (u256(-1) >> (256 - targetType->getNumBits() + forSignBit)))
|
||||
return true;
|
||||
}
|
||||
else if (-m_value <= (u256(1) << (targetType->getNumBits() - forSignBit)))
|
||||
else if (targetType->isSigned() && -m_value <= (u256(1) << (targetType->getNumBits() - forSignBit)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user