[Lldb-commits] [lldb] r183452 - Address::GetSection() turns a weak pointer to a shared pointer which is a little slow. So in Address::operator== & != do the

Jim Ingham jingham at apple.com
Thu Jun 6 15:16:57 PDT 2013


Author: jingham
Date: Thu Jun  6 17:16:56 2013
New Revision: 183452

URL: http://llvm.org/viewvc/llvm-project?rev=183452&view=rev
Log:
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.

Modified:
    lldb/trunk/source/Core/Address.cpp

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=183452&r1=183451&r2=183452&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Thu Jun  6 17:16:56 2013
@@ -1003,16 +1003,16 @@ lldb_private::operator> (const Address&
 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





More information about the lldb-commits mailing list