diff options
author | chriseth <chris@ethereum.org> | 2017-08-25 18:07:02 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-08-25 20:54:23 +0800 |
commit | 4b0e30d2592ef5561d98263696cb5550daa121e9 (patch) | |
tree | 54aab327ea713c80cc3523b2dcc0e6fad4399138 /libdevcore | |
parent | 1437521df0136fc3654dd74c816d724c50a125ee (diff) | |
download | dexon-solidity-4b0e30d2592ef5561d98263696cb5550daa121e9.tar dexon-solidity-4b0e30d2592ef5561d98263696cb5550daa121e9.tar.gz dexon-solidity-4b0e30d2592ef5561d98263696cb5550daa121e9.tar.bz2 dexon-solidity-4b0e30d2592ef5561d98263696cb5550daa121e9.tar.lz dexon-solidity-4b0e30d2592ef5561d98263696cb5550daa121e9.tar.xz dexon-solidity-4b0e30d2592ef5561d98263696cb5550daa121e9.tar.zst dexon-solidity-4b0e30d2592ef5561d98263696cb5550daa121e9.zip |
Cleanup of Common.h
Diffstat (limited to 'libdevcore')
-rw-r--r-- | libdevcore/Common.h | 58 | ||||
-rw-r--r-- | libdevcore/CommonData.h | 3 | ||||
-rw-r--r-- | libdevcore/FixedHash.h | 10 |
3 files changed, 16 insertions, 55 deletions
diff --git a/libdevcore/Common.h b/libdevcore/Common.h index 9d6dd408..2543855d 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -37,13 +37,7 @@ #pragma warning(disable:3682) //call through incomplete class #endif -#include <map> -#include <unordered_map> -#include <vector> -#include <set> -#include <unordered_set> -#include <functional> -#include <string> +#include <libdevcore/vector_ref.h> #if defined(__GNUC__) #pragma warning(push) @@ -67,14 +61,13 @@ #pragma GCC diagnostic pop #endif // defined(__GNUC__) -#include "vector_ref.h" +#include <map> +#include <vector> +#include <functional> +#include <string> using byte = uint8_t; -// Quote a given token stream to turn it into a string. -#define DEV_QUOTED_HELPER(s) #s -#define DEV_QUOTED(s) DEV_QUOTED_HELPER(s) - namespace dev { @@ -85,32 +78,15 @@ using bytesConstRef = vector_ref<byte const>; // Numeric types. using bigint = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<>>; -using u64 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<64, 64, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using u128 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<128, 128, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using u256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using s256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>; -using u160 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using s160 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<160, 160, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>; -using u512 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<512, 512, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; -using s512 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<512, 512, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>; -using u256s = std::vector<u256>; -using u160s = std::vector<u160>; -using u256Set = std::set<u256>; -using u160Set = std::set<u160>; +using u256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; +using s256 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<256, 256, boost::multiprecision::signed_magnitude, boost::multiprecision::unchecked, void>>; +using u160 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<160, 160, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>; // Map types. using StringMap = std::map<std::string, std::string>; -// Hash types. -using StringHashMap = std::unordered_map<std::string, std::string>; - // String types. using strings = std::vector<std::string>; -// Fixed-length string types. -using string32 = std::array<char, 32>; - -// Null/Invalid values for convenience. -static const bytes NullBytes; /// Interprets @a _u as a two's complement signed number and returns the resulting s256. inline s256 u2s(u256 _u) @@ -143,16 +119,6 @@ inline std::ostream& operator<<(std::ostream& os, bytes const& _bytes) return os; } -template <size_t n> inline u256 exp10() -{ - return exp10<n - 1>() * u256(10); -} - -template <> inline u256 exp10<0>() -{ - return u256(1); -} - /// RAII utility class whose destructor calls a given function. class ScopeGuard { @@ -164,12 +130,4 @@ private: std::function<void(void)> m_f; }; -enum class WithExisting: int -{ - Trust = 0, - Verify, - Rescue, - Kill -}; - } diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index 5df8986a..765707f8 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -26,11 +26,10 @@ #include <libdevcore/Common.h> #include <vector> -#include <algorithm> -#include <unordered_set> #include <type_traits> #include <cstring> #include <string> +#include <set> namespace dev { diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 141e9ffd..5bc70095 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -23,12 +23,16 @@ #pragma once +#include <libdevcore/CommonData.h> + +#include <boost/functional/hash.hpp> +#include <boost/io/ios_state.hpp> + #include <array> #include <cstdint> #include <algorithm> -#include <boost/functional/hash.hpp> -#include <boost/io/ios_state.hpp> -#include "CommonData.h" +#include <set> +#include <unordered_set> namespace dev { |