mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Cleanup of Common.h
This commit is contained in:
parent
1437521df0
commit
4b0e30d259
@ -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
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace dev
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user