mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-02 02:22:31 +00:00
memcmp is not a valid way to compare structs with padding in them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188778 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6ef333501e
commit
74e81aae7c
@ -123,10 +123,17 @@ public:
|
||||
RelocationValueRef(): SectionID(0), Offset(0), Addend(0), SymbolName(0) {}
|
||||
|
||||
inline bool operator==(const RelocationValueRef &Other) const {
|
||||
return std::memcmp(this, &Other, sizeof(RelocationValueRef)) == 0;
|
||||
return SectionID == Other.SectionID && Offset == Other.Offset &&
|
||||
Addend == Other.Addend && SymbolName == Other.SymbolName;
|
||||
}
|
||||
inline bool operator <(const RelocationValueRef &Other) const {
|
||||
return std::memcmp(this, &Other, sizeof(RelocationValueRef)) < 0;
|
||||
if (SectionID != Other.SectionID)
|
||||
return SectionID < Other.SectionID;
|
||||
if (Offset != Other.Offset)
|
||||
return Offset < Other.Offset;
|
||||
if (Addend != Other.Addend)
|
||||
return Addend < Other.Addend;
|
||||
return SymbolName < Other.SymbolName;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user