mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1344 from LefterisJP/sol_BytesToIntConv
Explicit conversion between bytes and int of any size
This commit is contained in:
commit
9e29d9797c
10
Types.cpp
10
Types.cpp
@ -536,14 +536,8 @@ bool FixedBytesType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
|
||||
bool FixedBytesType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
if (_convertTo.getCategory() == Category::Integer)
|
||||
{
|
||||
IntegerType const& convertTo = dynamic_cast<IntegerType const&>(_convertTo);
|
||||
if (m_bytes * 8 <= convertTo.getNumBits())
|
||||
return true;
|
||||
}
|
||||
|
||||
return _convertTo.getCategory() == Category::Contract ||
|
||||
return _convertTo.getCategory() == Category::Integer ||
|
||||
_convertTo.getCategory() == Category::Contract ||
|
||||
_convertTo.getCategory() == getCategory();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user