mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11399 from ethereum/hex-conversion
Turn toCompactHexWithPrefix into a template and support unsigned types
This commit is contained in:
commit
d61f21276d
@ -340,7 +340,7 @@ CompilerContext& CompilerContext::appendPanic(util::PanicCode _code)
|
||||
revert(0, 0x24)
|
||||
})");
|
||||
templ("selector", util::selectorFromSignature("Panic(uint256)").str());
|
||||
templ("code", u256(_code).str());
|
||||
templ("code", toCompactHexWithPrefix(static_cast<unsigned>(_code)));
|
||||
appendInlineAssembly(templ.render());
|
||||
return *this;
|
||||
}
|
||||
|
@ -4377,7 +4377,7 @@ string YulUtilFunctions::panicFunction(util::PanicCode _code)
|
||||
)")
|
||||
("functionName", functionName)
|
||||
("selector", util::selectorFromSignature("Panic(uint256)").str())
|
||||
("code", toCompactHexWithPrefix(_code))
|
||||
("code", toCompactHexWithPrefix(static_cast<unsigned>(_code)))
|
||||
.render();
|
||||
});
|
||||
}
|
||||
|
@ -404,7 +404,8 @@ inline std::string toHex(u256 val, HexPrefix prefix = HexPrefix::DontAdd)
|
||||
return (prefix == HexPrefix::Add) ? "0x" + str : str;
|
||||
}
|
||||
|
||||
inline std::string toCompactHexWithPrefix(u256 const& _value)
|
||||
template <class T>
|
||||
inline std::string toCompactHexWithPrefix(T _value)
|
||||
{
|
||||
return toHex(toCompactBigEndian(_value, 1), HexPrefix::Add);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user