summaryrefslogtreecommitdiff
path: root/mediumlevelilinstruction.h
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2025-10-20 23:28:36 -0700
committerMark Rowe <mark@vector35.com>2025-10-22 07:33:29 -0700
commit4c8fa3972ad50c07631418620eb9be44d629b2ae (patch)
tree449f00df976cc4a15602d6af4a196a91f54b6a69 /mediumlevelilinstruction.h
parent623f07a2b44ac9dbc86bab2ea011ee5899664f15 (diff)
Move implementations of key functions on Variable and SSAVariable to headers
These types are heavily used as map keys so allowing the compiler to inline these functions makes map lookups cheaper.
Diffstat (limited to 'mediumlevelilinstruction.h')
-rw-r--r--mediumlevelilinstruction.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/mediumlevelilinstruction.h b/mediumlevelilinstruction.h
index a1f8e00d..077ced5b 100644
--- a/mediumlevelilinstruction.h
+++ b/mediumlevelilinstruction.h
@@ -60,16 +60,25 @@ namespace BinaryNinja
struct SSAVariable
{
Variable var;
- size_t version;
+ size_t version = 0;
- SSAVariable();
- SSAVariable(const Variable& v, size_t i);
- SSAVariable(const SSAVariable& v);
+ // TODO: `= default` these when we can rely on C++20
+ bool operator==(const SSAVariable& other) const
+ {
+ return var == other.var && version == other.version;
+ }
- SSAVariable& operator=(const SSAVariable& v);
- bool operator==(const SSAVariable& v) const;
- bool operator!=(const SSAVariable& v) const;
- bool operator<(const SSAVariable& v) const;
+ bool operator!=(const SSAVariable& other) const
+ {
+ return !(*this == other);
+ }
+
+ bool operator<(const SSAVariable& other) const
+ {
+ if (var != other.var)
+ return var < other.var;
+ return version < other.version;
+ }
};
/*!