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

Use Span<T>.Fill implementation for Array.Fill #52590

Merged
merged 16 commits into from
Jun 30, 2021
Prev Previous commit
Next Next commit
fixup! 07dd088
  • Loading branch information
xtqqczze committed Jun 18, 2021
commit f6fee90d5ec13391762284ffa61428fb1f7645f6
3 changes: 1 addition & 2 deletions src/libraries/System.Private.CoreLib/src/System/Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,7 @@ public static void Fill<T>(T[] array, T value, int startIndex, int count)
else
{
ref T first = ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)startIndex);
var span = new Span<T>(ref first, count);
span.Fill(value);
new Span<T>(ref first, count).Fill(value);
}
}

Expand Down