aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore/CommonData.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-02-10 01:56:40 +0800
committerchriseth <chris@ethereum.org>2018-02-10 02:00:40 +0800
commitd84c9e148b0d9544cc81096eb6183648396807ae (patch)
tree7d91f34a5c1802cb7fd9ad1fac94ec346b9c96ee /libdevcore/CommonData.h
parent2095e7a32dce04f6142074bf96f14b6c7046137a (diff)
downloaddexon-solidity-d84c9e148b0d9544cc81096eb6183648396807ae.tar.gz
dexon-solidity-d84c9e148b0d9544cc81096eb6183648396807ae.tar.zst
dexon-solidity-d84c9e148b0d9544cc81096eb6183648396807ae.zip
Generic pretty-printed numbers..
Diffstat (limited to 'libdevcore/CommonData.h')
-rw-r--r--libdevcore/CommonData.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h
index b85abe95..e410af5c 100644
--- a/libdevcore/CommonData.h
+++ b/libdevcore/CommonData.h
@@ -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;