From 110ff3d9e8f9651d73286576e17f69f1e2ecfa31 Mon Sep 17 00:00:00 2001 From: Brian Popow <38701097+brianpopow@users.noreply.github.com> Date: Wed, 24 Nov 2021 12:38:44 +0100 Subject: [PATCH] Avoid using Span tmp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Günther Foidl --- src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs b/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs index 314f26d64..4f247c434 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs @@ -764,12 +764,12 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless if (Avx2.IsSupported) { double retVal = 0.0d; - Span tmp = stackalloc int[8]; + Vector256 tmp = Vector256.Zero; // has the size of the scratch space of sizeof(int) * 8 ref int xRef = ref MemoryMarshal.GetReference(x); ref int yRef = ref MemoryMarshal.GetReference(y); Vector256 sumXY256 = Vector256.Zero; Vector256 sumX256 = Vector256.Zero; - ref int tmpRef = ref MemoryMarshal.GetReference(tmp); + ref int tmpRef = ref Unsafe.As, int>(ref tmp); for (nint i = 0; i < 256; i += 8) { Vector256 xVec = Unsafe.As>(ref Unsafe.Add(ref xRef, i));