Skip to content

Commit

Permalink
Call byte SequenceEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
halter73 authored and safern committed Jan 11, 2020
1 parent 73cc7ed commit c20d9c3
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -897,8 +897,13 @@ public static int LastIndexOf(ref char searchSpace, int searchSpaceLength, ref c
break;

// Found the first element of "value". See if the tail matches.
if (SequenceEqual(ref Unsafe.Add(ref searchSpace, relativeIndex + 1), ref valueTail, valueTailLength))
if (SequenceEqual(
ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, relativeIndex + 1)),
ref Unsafe.As<char, byte>(ref valueTail),
(nuint)valueTailLength * 2))
{
return relativeIndex; // The tail matched. Return a successful find.
}

index += remainingSearchSpaceLength - relativeIndex;
}
Expand Down

0 comments on commit c20d9c3

Please sign in to comment.