aboutsummaryrefslogtreecommitdiffstats
path: root/Assembly.h
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2014-05-27 23:46:57 +0800
committerGav Wood <i@gavwood.com>2014-05-27 23:46:57 +0800
commit7476c6884ee22194b7d363c5e5401773d04bf47d (patch)
tree226bf8c1373d29a7ec7ad4cff56aaf4ae9853ae6 /Assembly.h
parent52fbe7dbfd57f4e884992b6596d54aadb070bd41 (diff)
downloaddexon-solidity-7476c6884ee22194b7d363c5e5401773d04bf47d.tar
dexon-solidity-7476c6884ee22194b7d363c5e5401773d04bf47d.tar.gz
dexon-solidity-7476c6884ee22194b7d363c5e5401773d04bf47d.tar.bz2
dexon-solidity-7476c6884ee22194b7d363c5e5401773d04bf47d.tar.lz
dexon-solidity-7476c6884ee22194b7d363c5e5401773d04bf47d.tar.xz
dexon-solidity-7476c6884ee22194b7d363c5e5401773d04bf47d.tar.zst
dexon-solidity-7476c6884ee22194b7d363c5e5401773d04bf47d.zip
Quick fix for eth -j; thread naming.
Diffstat (limited to 'Assembly.h')
-rw-r--r--Assembly.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/Assembly.h b/Assembly.h
index 5194d23f..2efff943 100644
--- a/Assembly.h
+++ b/Assembly.h
@@ -30,7 +30,7 @@
namespace eth
{
-enum AssemblyItemType { Operation, Push, PushString, PushTag, Tag, PushData };
+enum AssemblyItemType { UndefinedItem, Operation, Push, PushString, PushTag, Tag, PushData };
class Assembly;
@@ -41,7 +41,7 @@ class AssemblyItem
public:
AssemblyItem(u256 _push): m_type(Push), m_data(_push) {}
AssemblyItem(Instruction _i): m_type(Operation), m_data((byte)_i) {}
- AssemblyItem(AssemblyItemType _type, u256 _data): m_type(_type), m_data(_data) {}
+ AssemblyItem(AssemblyItemType _type, u256 _data = 0): m_type(_type), m_data(_data) {}
AssemblyItem tag() const { assert(m_type == PushTag || m_type == Tag); return AssemblyItem(Tag, m_data); }
AssemblyItem pushTag() const { assert(m_type == PushTag || m_type == Tag); return AssemblyItem(PushTag, m_data); }
@@ -51,14 +51,17 @@ public:
int deposit() const;
- bool operator==(int _mask) const { return -_mask == (int)m_type || (m_type == Operation && _mask == (int)m_data); }
+ bool match(AssemblyItem const& _i) const { return _i.m_type == UndefinedItem || (m_type == _i.m_type && (m_type != Operation || m_data == _i.m_data)); }
private:
AssemblyItemType m_type;
u256 m_data;
};
-inline bool operator==(int _i, AssemblyItem _ai) { return _ai.operator==(_i); }
+typedef std::vector<AssemblyItem> AssemblyItems;
+typedef vector_ref<AssemblyItem const> AssemblyItemsConstRef;
+
+std::ostream& operator<<(std::ostream& _out, AssemblyItemsConstRef _i);
class Assembly
{
@@ -104,7 +107,7 @@ private:
unsigned bytesRequired() const;
unsigned m_usedTags = 0;
- std::vector<AssemblyItem> m_items;
+ AssemblyItems m_items;
std::map<h256, bytes> m_data;
std::map<h256, std::string> m_strings;