mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #3478 from ethereum/simplifierFormatNumber
Format number nicely in the IULIA simplifier.
This commit is contained in:
commit
bf36821080
@ -155,6 +155,14 @@ inline std::string formatNumber(bigint const& _value)
|
||||
return _value.str();
|
||||
}
|
||||
|
||||
inline std::string formatNumber(u256 const& _value)
|
||||
{
|
||||
if (_value > 0x1000000)
|
||||
return toHex(toCompactBigEndian(_value), 2, HexPrefix::Add);
|
||||
else
|
||||
return _value.str();
|
||||
}
|
||||
|
||||
inline std::string toCompactHexWithPrefix(u256 val)
|
||||
{
|
||||
std::ostringstream ret;
|
||||
|
@ -154,7 +154,7 @@ Expression Pattern::toExpression(SourceLocation const& _location) const
|
||||
if (m_kind == PatternKind::Constant)
|
||||
{
|
||||
assertThrow(m_data, OptimizerException, "No match group and no constant value given.");
|
||||
return Literal{_location, assembly::LiteralKind::Number, m_data->str(), ""};
|
||||
return Literal{_location, assembly::LiteralKind::Number, formatNumber(*m_data), ""};
|
||||
}
|
||||
else if (m_kind == PatternKind::Operation)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user