mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 23:32:27 +00:00
Make operator== non-member for greater symmetry.
Thanks to David Blaikie for the suggestion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6ca5fd3f30
commit
814b52710a
@ -62,6 +62,7 @@ namespace yaml {
|
||||
/// } // end namespace llvm
|
||||
/// \endcode
|
||||
class BinaryRef {
|
||||
friend bool operator==(const BinaryRef &LHS, const BinaryRef &RHS);
|
||||
/// \brief Either raw binary data, or a string of hex bytes (must always
|
||||
/// be an even number of characters).
|
||||
ArrayRef<uint8_t> Data;
|
||||
@ -81,13 +82,6 @@ public:
|
||||
return Data.size() / 2;
|
||||
return Data.size();
|
||||
}
|
||||
bool operator==(const BinaryRef &RHS) {
|
||||
// Special case for default constructed BinaryRef.
|
||||
if (RHS.Data.empty() && Data.empty())
|
||||
return true;
|
||||
|
||||
return RHS.DataIsHexString == DataIsHexString && RHS.Data == Data;
|
||||
}
|
||||
/// \brief Write the contents (regardless of whether it is binary or a
|
||||
/// hex string) as binary to the given raw_ostream.
|
||||
void writeAsBinary(raw_ostream &OS) const;
|
||||
@ -98,6 +92,14 @@ public:
|
||||
void writeAsHex(raw_ostream &OS) const;
|
||||
};
|
||||
|
||||
inline bool operator==(const BinaryRef &LHS, const BinaryRef &RHS) {
|
||||
// Special case for default constructed BinaryRef.
|
||||
if (LHS.Data.empty() && RHS.Data.empty())
|
||||
return true;
|
||||
|
||||
return LHS.DataIsHexString == RHS.DataIsHexString && LHS.Data == RHS.Data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user