diff options
author | chriseth <chris@ethereum.org> | 2017-08-25 22:04:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-25 22:04:30 +0800 |
commit | 92ef30b7480d2fc0035aff232b558bb6d7419cc0 (patch) | |
tree | 03376260ef11a0b6d6484e8dcc2da7458f65a615 | |
parent | 0659043575c47e02dd3febdd3ad084eb8d2141d7 (diff) | |
parent | 4b0e30d2592ef5561d98263696cb5550daa121e9 (diff) | |
download | dexon-solidity-92ef30b7480d2fc0035aff232b558bb6d7419cc0.tar.gz dexon-solidity-92ef30b7480d2fc0035aff232b558bb6d7419cc0.tar.zst dexon-solidity-92ef30b7480d2fc0035aff232b558bb6d7419cc0.zip |
Merge pull request #2808 from ethereum/cleanCommonH
Clean common h
-rw-r--r-- | libdevcore/Common.h | 58 | ||||
-rw-r--r-- | libdevcore/CommonData.h | 3 | ||||
-rw-r--r-- | libdevcore/FixedHash.h | 10 | ||||
-rw-r--r-- | libevmasm/BlockDeduplicator.cpp | 5 | ||||
-rw-r--r-- | libevmasm/ExpressionClasses.h | 6 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 1 |
6 files changed, 25 insertions, 58 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 { diff --git a/libevmasm/BlockDeduplicator.cpp b/libevmasm/BlockDeduplicator.cpp index d21be07e..b7c69531 100644 --- a/libevmasm/BlockDeduplicator.cpp +++ b/libevmasm/BlockDeduplicator.cpp @@ -22,10 +22,13 @@ */ #include <libevmasm/BlockDeduplicator.h> -#include <functional> + #include <libevmasm/AssemblyItem.h> #include <libevmasm/SemanticInformation.h> +#include <functional> +#include <set> + using namespace std; using namespace dev; using namespace dev::eth; diff --git a/libevmasm/ExpressionClasses.h b/libevmasm/ExpressionClasses.h index 5d53b292..6b426e97 100644 --- a/libevmasm/ExpressionClasses.h +++ b/libevmasm/ExpressionClasses.h @@ -23,11 +23,13 @@ #pragma once +#include <libdevcore/Common.h> +#include <libevmasm/AssemblyItem.h> + #include <vector> #include <map> #include <memory> -#include <libdevcore/Common.h> -#include <libevmasm/AssemblyItem.h> +#include <set> namespace dev { diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index ce2d3bf8..310c34fe 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -36,6 +36,7 @@ #include <memory> #include <string> #include <map> +#include <set> namespace dev { |