Skip to content

Commit

Permalink
[release/7.0-rc2] [Mono] Restore old code to solve the recent SpanHel…
Browse files Browse the repository at this point in the history
…pers regressions (#75996)

* bring back the old code...

* bring back more old code

* Use an ifdef around clr code instead of a separate file

* Delete SpanHelpers.Clr.cs

* Remove a remaining INumber<T> helper from mono

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 22, 2022
1 parent 132f297 commit 550605c
Show file tree
Hide file tree
Showing 4 changed files with 2,718 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2457,4 +2457,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Numerics\IUnaryPlusOperators.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Numerics\IUnsignedNumber.cs" />
</ItemGroup>
<ItemGroup Condition="'$(FeatureMono)' == 'true'">
<Compile Include="$(MSBuildThisFileDirectory)System\SpanHelpers.Mono.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -1617,6 +1617,7 @@ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
Unsafe.Add(ref valueRef, 2),
span.Length);

#if !MONO // We don't have a mono overload for 4 values
case 4:
return SpanHelpers.LastIndexOfAnyValueType(
ref spanRef,
Expand All @@ -1625,6 +1626,7 @@ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
Unsafe.Add(ref valueRef, 2),
Unsafe.Add(ref valueRef, 3),
span.Length);
#endif

default:
return LastIndexOfAnyProbabilistic(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length);
Expand Down
Loading

0 comments on commit 550605c

Please sign in to comment.