We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e1a2cad commit c97520dCopy full SHA for c97520d
src/libraries/System.Collections/src/System/Collections/BitArray.cs
@@ -335,9 +335,13 @@ public void Set(int index, bool value)
335
=========================================================================*/
336
public void SetAll(bool value)
337
{
338
- int fillValue = value ? -1 : 0;
339
int arrayLength = GetInt32ArrayLengthFromBitLength(Length);
340
- m_array.AsSpan(0, arrayLength).Fill(fillValue);
+ Span<int> span = m_array.AsSpan(0, arrayLength);
+ if (value)
341
+ span.Fill(-1);
342
+ else
343
+ span.Clear();
344
+
345
_version++;
346
}
347
0 commit comments