Merge pull request #1344 from LefterisJP/sol_BytesToIntConv

Explicit conversion between bytes and int of any size
This commit is contained in:
chriseth 2015-03-19 13:05:28 +01:00
commit 9e29d9797c

View File

@ -536,14 +536,8 @@ bool FixedBytesType::isImplicitlyConvertibleTo(Type const& _convertTo) const
bool FixedBytesType::isExplicitlyConvertibleTo(Type const& _convertTo) const bool FixedBytesType::isExplicitlyConvertibleTo(Type const& _convertTo) const
{ {
if (_convertTo.getCategory() == Category::Integer) return _convertTo.getCategory() == Category::Integer ||
{ _convertTo.getCategory() == Category::Contract ||
IntegerType const& convertTo = dynamic_cast<IntegerType const&>(_convertTo);
if (m_bytes * 8 <= convertTo.getNumBits())
return true;
}
return _convertTo.getCategory() == Category::Contract ||
_convertTo.getCategory() == getCategory(); _convertTo.getCategory() == getCategory();
} }