Skip to content

Commit

Permalink
Remove Mono SpanHelpers workaround (#79821)
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan authored Dec 21, 2022
1 parent 23059de commit 942ce9a
Showing 1 changed file with 0 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@ internal override unsafe bool ContainsCore(T value) =>
*(TImpl*)&value == _e2 ||
*(TImpl*)&value == _e3;

#if MONO // Revert this once https://github.com/dotnet/runtime/pull/78015 is merged
internal override int IndexOfAny(ReadOnlySpan<T> span) =>
span.IndexOfAny(GetValues());

internal override int IndexOfAnyExcept(ReadOnlySpan<T> span) =>
span.IndexOfAnyExcept(GetValues());

internal override int LastIndexOfAny(ReadOnlySpan<T> span) =>
span.LastIndexOfAny(GetValues());

internal override int LastIndexOfAnyExcept(ReadOnlySpan<T> span) =>
span.LastIndexOfAnyExcept(GetValues());
#else
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal override int IndexOfAny(ReadOnlySpan<T> span) =>
SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
Expand All @@ -64,6 +51,5 @@ internal override int LastIndexOfAny(ReadOnlySpan<T> span) =>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal override int LastIndexOfAnyExcept(ReadOnlySpan<T> span) =>
SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
#endif
}
}

0 comments on commit 942ce9a

Please sign in to comment.