Skip to content

Commit

Permalink
Fix assert and code typo
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan committed Jul 23, 2023
1 parent 01ed856 commit 419a352
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ private readonly int IndexOfAnyCore<TCaseSensitivity>(ReadOnlySpan<char> span)
{
Debug.Assert(typeof(TCaseSensitivity) != typeof(CaseInsensitiveUnicode));
Debug.Assert(span.Length <= MaxInputLength, "Teddy should have handled short inputs.");
Debug.Assert(_buckets is not null);

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

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

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

while (true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private static bool ScalarEquals<TCaseSensitivity>(ref char matchStart, string c
{
for (int i = 0; i < candidate.Length; i++)
{
if (TCaseSensitivity.TransformInput(candidate[i]) != Unsafe.Add(ref matchStart, i))
if (TCaseSensitivity.TransformInput(Unsafe.Add(ref matchStart, i)) != candidate[i])
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ private int IndexOf(ref char searchSpace, int searchSpaceLength)
}

ShortInput:
Debug.Assert(searchSpaceLength < Vector128<ushort>.Count);

string value = _value;
char valueHead = value.GetRawStringData();

Expand Down

0 comments on commit 419a352

Please sign in to comment.