summaryrefslogtreecommitdiff
path: root/binaryninjaapi.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 /binaryninjaapi.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 'binaryninjaapi.h')
-rw-r--r--binaryninjaapi.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 90ee2585..9e90eeb8 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -10048,17 +10048,38 @@ namespace BinaryNinja {
*/
struct Variable : public BNVariable
{
- Variable();
- Variable(BNVariableSourceType type, uint32_t index, uint64_t storage);
- Variable(BNVariableSourceType type, uint64_t storage);
- Variable(const BNVariable& var);
- Variable(const Variable& var);
+ Variable() : BNVariable{RegisterVariableSourceType, 0, 0} {}
+ Variable(BNVariableSourceType type, uint64_t storage) : Variable(type, 0, storage) {}
+ Variable(BNVariableSourceType type, uint32_t index, uint64_t storage)
+ : BNVariable{type, index, static_cast<int64_t>(storage)}
+ {
+ }
+ Variable(const BNVariable& var) : BNVariable(var) {}
+
+ Variable(const Variable&) = default;
+ Variable& operator=(const Variable&) = default;
- Variable& operator=(const Variable& var);
+ Variable(Variable&&) = default;
+ Variable& operator=(Variable&&) = default;
+
+ bool operator==(const Variable& var) const
+ {
+ return type == var.type && index == var.index && storage == var.storage;
+ }
- bool operator==(const Variable& var) const;
- bool operator!=(const Variable& var) const;
- bool operator<(const Variable& var) const;
+ bool operator!=(const Variable& var) const
+ {
+ return !(*this == var);
+ }
+
+ bool operator<(const Variable& var) const
+ {
+ if (type != var.type)
+ return type < var.type;
+ if (storage != var.storage)
+ return storage < var.storage;
+ return index < var.index;
+ }
uint64_t ToIdentifier() const;
static Variable FromIdentifier(uint64_t id);