Skip to content

Commit 419a352

Browse files
committed
Fix assert and code typo
1 parent 01ed856 commit 419a352

File tree

3 files changed

+2
-4
lines changed

3 files changed

+2
-4
lines changed

src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/Helpers/RabinKarp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ private readonly int IndexOfAnyCore<TCaseSensitivity>(ReadOnlySpan<char> span)
103103
{
104104
Debug.Assert(typeof(TCaseSensitivity) != typeof(CaseInsensitiveUnicode));
105105
Debug.Assert(span.Length <= MaxInputLength, "Teddy should have handled short inputs.");
106-
Debug.Assert(_buckets is not null);
107106

108107
ref char current = ref MemoryMarshal.GetReference(span);
109108

@@ -119,6 +118,7 @@ private readonly int IndexOfAnyCore<TCaseSensitivity>(ReadOnlySpan<char> span)
119118
hash = (hash << HashShiftPerElement) + TCaseSensitivity.TransformInput(Unsafe.Add(ref current, i));
120119
}
121120

121+
Debug.Assert(_buckets is not null);
122122
ref string[]? bucketsRef = ref MemoryMarshal.GetArrayDataReference(_buckets);
123123

124124
while (true)

src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/Helpers/StringSearchValuesHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private static bool ScalarEquals<TCaseSensitivity>(ref char matchStart, string c
4747
{
4848
for (int i = 0; i < candidate.Length; i++)
4949
{
50-
if (TCaseSensitivity.TransformInput(candidate[i]) != Unsafe.Add(ref matchStart, i))
50+
if (TCaseSensitivity.TransformInput(Unsafe.Add(ref matchStart, i)) != candidate[i])
5151
{
5252
return false;
5353
}

src/libraries/System.Private.CoreLib/src/System/SearchValues/Strings/SingleStringSearchValuesThreeChars.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ private int IndexOf(ref char searchSpace, int searchSpaceLength)
207207
}
208208

209209
ShortInput:
210-
Debug.Assert(searchSpaceLength < Vector128<ushort>.Count);
211-
212210
string value = _value;
213211
char valueHead = value.GetRawStringData();
214212

0 commit comments

Comments
 (0)