From 4b0e30d2592ef5561d98263696cb5550daa121e9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 25 Aug 2017 12:07:02 +0200 Subject: [PATCH] Cleanup of Common.h --- libdevcore/Common.h | 58 +++++---------------------------- libdevcore/CommonData.h | 3 +- libdevcore/FixedHash.h | 10 ++++-- libevmasm/BlockDeduplicator.cpp | 5 ++- libevmasm/ExpressionClasses.h | 6 ++-- libsolidity/ast/Types.h | 1 + 6 files changed, 25 insertions(+), 58 deletions(-) diff --git a/libdevcore/Common.h b/libdevcore/Common.h index 9d6dd408b..2543855d3 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -37,13 +37,7 @@ #pragma warning(disable:3682) //call through incomplete class #endif -#include -#include -#include -#include -#include -#include -#include +#include #if defined(__GNUC__) #pragma warning(push) @@ -67,14 +61,13 @@ #pragma GCC diagnostic pop #endif // defined(__GNUC__) -#include "vector_ref.h" +#include +#include +#include +#include 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; // Numeric types. using bigint = boost::multiprecision::number>; -using u64 = boost::multiprecision::number>; -using u128 = boost::multiprecision::number>; -using u256 = boost::multiprecision::number>; -using s256 = boost::multiprecision::number>; -using u160 = boost::multiprecision::number>; -using s160 = boost::multiprecision::number>; -using u512 = boost::multiprecision::number>; -using s512 = boost::multiprecision::number>; -using u256s = std::vector; -using u160s = std::vector; -using u256Set = std::set; -using u160Set = std::set; +using u256 = boost::multiprecision::number>; +using s256 = boost::multiprecision::number>; +using u160 = boost::multiprecision::number>; // Map types. using StringMap = std::map; -// Hash types. -using StringHashMap = std::unordered_map; - // String types. using strings = std::vector; -// Fixed-length string types. -using string32 = std::array; - -// 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 inline u256 exp10() -{ - return exp10() * 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 m_f; }; -enum class WithExisting: int -{ - Trust = 0, - Verify, - Rescue, - Kill -}; - } diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index 5df8986a8..765707f80 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -26,11 +26,10 @@ #include #include -#include -#include #include #include #include +#include namespace dev { diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 141e9ffd0..5bc700950 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -23,12 +23,16 @@ #pragma once +#include + +#include +#include + #include #include #include -#include -#include -#include "CommonData.h" +#include +#include namespace dev { diff --git a/libevmasm/BlockDeduplicator.cpp b/libevmasm/BlockDeduplicator.cpp index d21be07e7..b7c695311 100644 --- a/libevmasm/BlockDeduplicator.cpp +++ b/libevmasm/BlockDeduplicator.cpp @@ -22,10 +22,13 @@ */ #include -#include + #include #include +#include +#include + using namespace std; using namespace dev; using namespace dev::eth; diff --git a/libevmasm/ExpressionClasses.h b/libevmasm/ExpressionClasses.h index 5d53b2921..6b426e971 100644 --- a/libevmasm/ExpressionClasses.h +++ b/libevmasm/ExpressionClasses.h @@ -23,11 +23,13 @@ #pragma once +#include +#include + #include #include #include -#include -#include +#include namespace dev { diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index ce2d3bf8c..310c34fea 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -36,6 +36,7 @@ #include #include #include +#include namespace dev {