Address::GetSection() turns a weak pointer to a shared pointer which is a little slow. So in Address::operator== & != do the
cheap GetOffset() comparison first and only compare the sections if that is true.
llvm-svn: 183452
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp
index 0b3db3d..48a3e21 100644
--- a/lldb/source/Core/Address.cpp
+++ b/lldb/source/Core/Address.cpp
@@ -1003,16 +1003,16 @@
bool
lldb_private::operator== (const Address& a, const Address& rhs)
{
- return a.GetSection() == rhs.GetSection() &&
- a.GetOffset() == rhs.GetOffset();
+ return a.GetOffset() == rhs.GetOffset() &&
+ a.GetSection() == rhs.GetSection();
}
// The operator != checks for exact inequality only (differing section, or
// different offset)
bool
lldb_private::operator!= (const Address& a, const Address& rhs)
{
- return a.GetSection() != rhs.GetSection() ||
- a.GetOffset() != rhs.GetOffset();
+ return a.GetOffset() != rhs.GetOffset() ||
+ a.GetSection() != rhs.GetSection();
}
AddressClass