Turn toCompactHexWithPrefix into a template and support unsigned types

This should help with boost::multiprecision versions where explicit unsigned/enum conversion to bigint do not exists (such as boost 1.76)
This commit is contained in:
Alex Beregszaszi
2021-05-15 23:33:29 +01:00
parent f58d58738e
commit 6dae6583af
3 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -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);
}