Cleanup/Housekeeping (#242)

This commit is contained in:
Kamron Batman 2020-09-12 15:31:21 -07:00 committed by GitHub
parent 90ede0659f
commit 741e8d8300
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
228 changed files with 6292 additions and 2690 deletions

View file

@ -110,7 +110,10 @@ namespace System.Buffers
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Ensure(int count = 1)
{
if (_span.Length < count) EnsureMore(count);
if (_span.Length < count)
{
EnsureMore(count);
}
}
/// <summary>
@ -120,7 +123,10 @@ namespace System.Buffers
[MethodImpl(MethodImplOptions.NoInlining)]
private void EnsureMore(int count = 0)
{
if (_buffered > 0) Commit();
if (_buffered > 0)
{
Commit();
}
_span = _output.GetSpan(count);
}
@ -133,7 +139,10 @@ namespace System.Buffers
{
while (source.Length > 0)
{
if (_span.Length == 0) EnsureMore();
if (_span.Length == 0)
{
EnsureMore();
}
var writable = Math.Min(source.Length, _span.Length);
source.Slice(0, writable).CopyTo(_span);