[Lldb-commits] [lldb] r350149 - [RegisterValue] Rewrite operator!= in terms of operator==. NFCI.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 28 21:05:24 PST 2018


Author: davide
Date: Fri Dec 28 21:05:23 2018
New Revision: 350149

URL: http://llvm.org/viewvc/llvm-project?rev=350149&view=rev
Log:
[RegisterValue] Rewrite operator!= in terms of operator==. NFCI.

Modified:
    lldb/trunk/source/Utility/RegisterValue.cpp

Modified: lldb/trunk/source/Utility/RegisterValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/RegisterValue.cpp?rev=350149&r1=350148&r2=350149&view=diff
==============================================================================
--- lldb/trunk/source/Utility/RegisterValue.cpp (original)
+++ lldb/trunk/source/Utility/RegisterValue.cpp Fri Dec 28 21:05:23 2018
@@ -793,32 +793,7 @@ bool RegisterValue::operator==(const Reg
 }
 
 bool RegisterValue::operator!=(const RegisterValue &rhs) const {
-  if (m_type != rhs.m_type)
-    return true;
-  switch (m_type) {
-  case eTypeInvalid:
-    return false;
-  case eTypeUInt8:
-  case eTypeUInt16:
-  case eTypeUInt32:
-  case eTypeUInt64:
-  case eTypeUInt128:
-  case eTypeFloat:
-  case eTypeDouble:
-  case eTypeLongDouble:
-    return m_scalar != rhs.m_scalar;
-  case eTypeBytes:
-    if (buffer.length != rhs.buffer.length) {
-      return true;
-    } else {
-      uint8_t length = buffer.length;
-      if (length > kMaxRegisterByteSize)
-        length = kMaxRegisterByteSize;
-      return memcmp(buffer.bytes, rhs.buffer.bytes, length) != 0;
-    }
-    break;
-  }
-  return true;
+  return !(*this == rhs);
 }
 
 bool RegisterValue::ClearBit(uint32_t bit) {




More information about the lldb-commits mailing list