Skip to content

Commit c4ff86d

Browse files
authored
Ascii.Equals: remove redundant OR (#88993)
both inputs are equal here so if one of them is non ASCII, then the other one is too
1 parent 56552c2 commit c4ff86d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libraries/System.Private.CoreLib/src/System/Text/Ascii.Equality.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private static bool Equals<TLeft, TRight, TLoader>(ref TLeft left, ref TRight ri
5555
uint valueA = uint.CreateTruncating(Unsafe.Add(ref left, i));
5656
uint valueB = uint.CreateTruncating(Unsafe.Add(ref right, i));
5757

58-
if (valueA != valueB || !UnicodeUtility.IsAsciiCodePoint(valueA | valueB))
58+
if (valueA != valueB || !UnicodeUtility.IsAsciiCodePoint(valueA))
5959
{
6060
return false;
6161
}
@@ -108,7 +108,7 @@ private static bool Equals<TLeft, TRight, TLoader>(ref TLeft left, ref TRight ri
108108
leftValues = TLoader.Load128(ref currentLeftSearchSpace);
109109
rightValues = Vector128.LoadUnsafe(ref currentRightSearchSpace);
110110

111-
if (leftValues != rightValues || !AllCharsInVectorAreAscii(leftValues | rightValues))
111+
if (leftValues != rightValues || !AllCharsInVectorAreAscii(leftValues))
112112
{
113113
return false;
114114
}
@@ -124,7 +124,7 @@ private static bool Equals<TLeft, TRight, TLoader>(ref TLeft left, ref TRight ri
124124
leftValues = TLoader.Load128(ref oneVectorAwayFromLeftEnd);
125125
rightValues = Vector128.LoadUnsafe(ref oneVectorAwayFromRightEnd);
126126

127-
if (leftValues != rightValues || !AllCharsInVectorAreAscii(leftValues | rightValues))
127+
if (leftValues != rightValues || !AllCharsInVectorAreAscii(leftValues))
128128
{
129129
return false;
130130
}

0 commit comments

Comments
 (0)