Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static int IndexOf(ref byte searchSpace, int searchSpaceLength, ref byte
break; // The unsearched portion is now shorter than the sequence we're looking for. So it can't be there.

// Found the first element of "value". See if the tail matches.
if (SequenceEqual(ref Unsafe.Add(ref searchSpace, offset + 1), ref valueTail, valueTailLength))
if (SequenceEqual(ref Unsafe.Add(ref searchSpace, offset + 1), ref valueTail, (nuint)valueTailLength)) // The (nunit)-cast is necessary to pick the correct overload
return offset; // The tail matched. Return a successful find.

remainingSearchSpaceLength--;
Expand Down Expand Up @@ -450,7 +450,7 @@ public static int LastIndexOf(ref byte searchSpace, int searchSpaceLength, ref b
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.Add(ref searchSpace, relativeIndex + 1), ref valueTail, (nuint)valueTailLength)) // The (nunit)-cast is necessary to pick the correct overload
return relativeIndex; // The tail matched. Return a successful find.

offset += remainingSearchSpaceLength - relativeIndex;
Expand Down