From f0c2337358fc43ad9c79294c539c4ddec4280011 Mon Sep 17 00:00:00 2001 From: vnugent Date: Fri, 28 Jul 2023 11:59:28 -0400 Subject: Compressor control refactor, reduce copy --- lib/Utils/src/Extensions/IoExtensions.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/Utils/src/Extensions') diff --git a/lib/Utils/src/Extensions/IoExtensions.cs b/lib/Utils/src/Extensions/IoExtensions.cs index 637cfab..bcbe810 100644 --- a/lib/Utils/src/Extensions/IoExtensions.cs +++ b/lib/Utils/src/Extensions/IoExtensions.cs @@ -1,5 +1,5 @@ /* -* Copyright (c) 2022 Vaughn Nugent +* Copyright (c) 2023 Vaughn Nugent * * Library: VNLib * Package: VNLib.Utils @@ -328,12 +328,11 @@ namespace VNLib.Utils.Extensions * bytes from the source */ long total = 0; - int bufferSize = buffer.Length; int read; while (true) { //get offset wrapper of the total buffer or remaining count - Memory offset = buffer[..(int)Math.Min(bufferSize, count - total)]; + Memory offset = buffer[..(int)Math.Min(buffer.Length, count - total)]; //read read = await source.ReadAsync(offset, token); //Guard -- cgit