mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-24 04:56:51 +00:00
Use the RHS length instead of the LHS length. They are both the same,
but this ends up compiling code like this: int foo(const StringRef &R) { return R == "food"; } to use a constant sized memcmp instead of a variable memcmp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77160 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f9474ca928
commit
7e763ebd98
@ -81,7 +81,7 @@ namespace llvm {
|
||||
/// compare() in when the relative ordering of inequal strings isn't needed.
|
||||
bool equals(const StringRef &RHS) const {
|
||||
return (Length == RHS.Length &&
|
||||
memcmp(Data, RHS.Data, Length) == 0);
|
||||
memcmp(Data, RHS.Data, RHS.Length) == 0);
|
||||
}
|
||||
|
||||
/// compare - Compare two strings; the result is -1, 0, or 1 if this string
|
||||
|
Loading…
Reference in New Issue
Block a user