mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-29 14:40:39 +00:00
StringRef::compare_numeric also differed from StringRef::compare for characters > 127.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112189 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0043e35b82
commit
837bccd052
@ -59,7 +59,7 @@ int StringRef::compare_numeric(StringRef RHS) const {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Data[I] < RHS.Data[I] ? -1 : 1;
|
||||
return (unsigned char)Data[I] < (unsigned char)RHS.Data[I] ? -1 : 1;
|
||||
}
|
||||
if (Length == RHS.Length)
|
||||
return 0;
|
||||
|
@ -72,6 +72,7 @@ TEST(StringRefTest, StringOps) {
|
||||
EXPECT_EQ( 0, StringRef("10a").compare_numeric("10a"));
|
||||
EXPECT_EQ( 1, StringRef("2").compare_numeric("1"));
|
||||
EXPECT_EQ( 0, StringRef("llvm_v1i64_ty").compare_numeric("llvm_v1i64_ty"));
|
||||
EXPECT_EQ( 1, StringRef("\xFF").compare_numeric("\1"));
|
||||
}
|
||||
|
||||
TEST(StringRefTest, Operators) {
|
||||
|
Loading…
Reference in New Issue
Block a user