Skip to content

Commit

Permalink
Use span.Clear instead of Fill(0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnbrkm41 committed Mar 28, 2020
1 parent e1a2cad commit c97520d
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,13 @@ public void Set(int index, bool value)
=========================================================================*/
public void SetAll(bool value)
{
int fillValue = value ? -1 : 0;
int arrayLength = GetInt32ArrayLengthFromBitLength(Length);
m_array.AsSpan(0, arrayLength).Fill(fillValue);
Span<int> span = m_array.AsSpan(0, arrayLength);
if (value)
span.Fill(-1);
else
span.Clear();

_version++;
}

Expand Down

0 comments on commit c97520d

Please sign in to comment.