Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Mono SpanHelpers workaround #79821

Merged
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 @@ -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
}
}