diff options
author | chriseth <chris@ethereum.org> | 2018-12-06 05:13:41 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-12-06 05:51:49 +0800 |
commit | 936c67415ae058984c5666c44bf68fd1ebfaf23a (patch) | |
tree | 8c7cc409fd8155580947ecf7a0f5fd385fe0336f /libdevcore | |
parent | bc6ddbdd09860542061baed8df993cb3dafaa406 (diff) | |
download | dexon-solidity-936c67415ae058984c5666c44bf68fd1ebfaf23a.tar.gz dexon-solidity-936c67415ae058984c5666c44bf68fd1ebfaf23a.tar.zst dexon-solidity-936c67415ae058984c5666c44bf68fd1ebfaf23a.zip |
Simplify hex prefix.
Diffstat (limited to 'libdevcore')
-rw-r--r-- | libdevcore/CommonData.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libdevcore/CommonData.cpp b/libdevcore/CommonData.cpp index a289c8ed..1b0e9720 100644 --- a/libdevcore/CommonData.cpp +++ b/libdevcore/CommonData.cpp @@ -32,6 +32,9 @@ using namespace dev; string dev::toHex(bytes const& _data, HexPrefix _prefix, HexCase _case) { std::ostringstream ret; + if (_prefix == HexPrefix::Add) + ret << "0x"; + int rix = _data.size() - 1; for (uint8_t c: _data) { @@ -45,7 +48,7 @@ string dev::toHex(bytes const& _data, HexPrefix _prefix, HexCase _case) ret << std::hex << hexcase << std::setfill('0') << std::setw(2) << size_t(c); } - return (_prefix == HexPrefix::Add) ? "0x" + ret.str() : ret.str(); + return ret.str(); } int dev::fromHex(char _i, WhenError _throw) |