diff options
author | chriseth <chris@ethereum.org> | 2018-12-18 20:14:12 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-12-18 23:10:14 +0800 |
commit | 01249984f2b5cbabc9fe3d4fd98917c606f77931 (patch) | |
tree | 41651badfca031c3cbb51787a003dab53a6341b9 | |
parent | 18efbb52c0e22a6bac4427053dbda66d38319cbf (diff) | |
download | dexon-solidity-01249984f2b5cbabc9fe3d4fd98917c606f77931.tar dexon-solidity-01249984f2b5cbabc9fe3d4fd98917c606f77931.tar.gz dexon-solidity-01249984f2b5cbabc9fe3d4fd98917c606f77931.tar.bz2 dexon-solidity-01249984f2b5cbabc9fe3d4fd98917c606f77931.tar.lz dexon-solidity-01249984f2b5cbabc9fe3d4fd98917c606f77931.tar.xz dexon-solidity-01249984f2b5cbabc9fe3d4fd98917c606f77931.tar.zst dexon-solidity-01249984f2b5cbabc9fe3d4fd98917c606f77931.zip |
Provide comparison shortcut.
-rw-r--r-- | libevmasm/AssemblyItem.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libevmasm/AssemblyItem.h b/libevmasm/AssemblyItem.h index e17179fa..d21be199 100644 --- a/libevmasm/AssemblyItem.h +++ b/libevmasm/AssemblyItem.h @@ -118,6 +118,13 @@ public: return data() < _other.data(); } + /// Shortcut that avoids constructing an AssemblyItem just to perform the comparison. + bool operator==(Instruction _instr) const + { + return type() == Operation && instruction() == _instr; + } + bool operator!=(Instruction _instr) const { return !operator==(_instr); } + /// @returns an upper bound for the number of bytes required by this item, assuming that /// the value of a jump tag takes @a _addressLength bytes. unsigned bytesRequired(unsigned _addressLength) const; |