From 01249984f2b5cbabc9fe3d4fd98917c606f77931 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 18 Dec 2018 13:14:12 +0100 Subject: Provide comparison shortcut. --- libevmasm/AssemblyItem.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libevmasm') 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; -- cgit