diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs index fd8a61350f..8ba1b09125 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs @@ -673,7 +673,7 @@ internal static partial class SimdUtils ReadOnlySpan source, Span dest) { - fixed (byte* sourceBase = &MemoryMarshal.GetReference(source)) + fixed (byte* sourceBase = source) { if (Avx2.IsSupported) { diff --git a/src/ImageSharp/Compression/Zlib/Adler32.cs b/src/ImageSharp/Compression/Zlib/Adler32.cs index 3ecdf81539..dd8217541a 100644 --- a/src/ImageSharp/Compression/Zlib/Adler32.cs +++ b/src/ImageSharp/Compression/Zlib/Adler32.cs @@ -387,7 +387,7 @@ internal static class Adler32 uint s1 = adler & 0xFFFF; uint s2 = (adler >> 16) & 0xFFFF; - fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer)) + fixed (byte* bufferPtr = buffer) { byte* localBufferPtr = bufferPtr; uint length = (uint)buffer.Length; diff --git a/src/ImageSharp/Compression/Zlib/Crc32.cs b/src/ImageSharp/Compression/Zlib/Crc32.cs index e21621ab74..2d0a09bd4c 100644 --- a/src/ImageSharp/Compression/Zlib/Crc32.cs +++ b/src/ImageSharp/Compression/Zlib/Crc32.cs @@ -81,7 +81,7 @@ internal static partial class Crc32 int chunksize = buffer.Length & ~ChunksizeMask; int length = chunksize; - fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer)) + fixed (byte* bufferPtr = buffer) { fixed (ulong* k05PolyPtr = K05Poly) { @@ -201,7 +201,7 @@ internal static partial class Crc32 [MethodImpl(InliningOptions.HotPath | InliningOptions.ShortMethod)] private static unsafe uint CalculateArm(uint crc, ReadOnlySpan buffer) { - fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer)) + fixed (byte* bufferPtr = buffer) { byte* localBufferPtr = bufferPtr; int len = buffer.Length; @@ -248,7 +248,7 @@ internal static partial class Crc32 [MethodImpl(InliningOptions.HotPath | InliningOptions.ShortMethod)] private static unsafe uint CalculateArm64(uint crc, ReadOnlySpan buffer) { - fixed (byte* bufferPtr = &MemoryMarshal.GetReference(buffer)) + fixed (byte* bufferPtr = buffer) { byte* localBufferPtr = bufferPtr; int len = buffer.Length; diff --git a/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs b/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs index ab6e4cfccf..024adb7c23 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs @@ -569,7 +569,7 @@ internal static unsafe class LosslessUtils Span pixelData, Span outputSpan) { - fixed (uint* inputFixed = &MemoryMarshal.GetReference(pixelData)) + fixed (uint* inputFixed = pixelData) { fixed (uint* outputFixed = outputSpan) { diff --git a/src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs b/src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs index 4113579637..689c63f5b1 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/PredictorEncoder.cs @@ -353,8 +353,8 @@ internal static unsafe class PredictorEncoder else { #pragma warning disable SA1503 // Braces should not be omitted - fixed (uint* currentRow = &MemoryMarshal.GetReference(currentRowSpan)) - fixed (uint* upperRow = &MemoryMarshal.GetReference(upperRowSpan)) + fixed (uint* currentRow = currentRowSpan) + fixed (uint* upperRow = upperRowSpan) { for (int x = xStart; x < xEnd; x++) { @@ -664,9 +664,9 @@ internal static unsafe class PredictorEncoder Span scratch) { #pragma warning disable SA1503 // Braces should not be omitted - fixed (uint* current = &MemoryMarshal.GetReference(currentSpan)) - fixed (uint* upper = &MemoryMarshal.GetReference(upperSpan)) - fixed (uint* outputFixed = &MemoryMarshal.GetReference(outputSpan)) + fixed (uint* current = currentSpan) + fixed (uint* upper = upperSpan) + fixed (uint* outputFixed = outputSpan) { uint* output = outputFixed; if (xStart == 0) diff --git a/src/ImageSharp/Formats/Webp/WebpCommonUtils.cs b/src/ImageSharp/Formats/Webp/WebpCommonUtils.cs index 735d0bf557..4a7dc74ca7 100644 --- a/src/ImageSharp/Formats/Webp/WebpCommonUtils.cs +++ b/src/ImageSharp/Formats/Webp/WebpCommonUtils.cs @@ -81,7 +81,7 @@ internal static class WebpCommonUtils ReadOnlySpan rowBytes = MemoryMarshal.AsBytes(row); int i = 0; int length = (row.Length * 4) - 3; - fixed (byte* src = &MemoryMarshal.GetReference(rowBytes)) + fixed (byte* src = rowBytes) { for (; i + 64 <= length; i += 64) { diff --git a/src/ImageSharp/Memory/Buffer2DExtensions.cs b/src/ImageSharp/Memory/Buffer2DExtensions.cs index 31617c163b..2eb05ea935 100644 --- a/src/ImageSharp/Memory/Buffer2DExtensions.cs +++ b/src/ImageSharp/Memory/Buffer2DExtensions.cs @@ -50,7 +50,7 @@ public static class Buffer2DExtensions Span span = MemoryMarshal.AsBytes(buffer.DangerousGetSingleMemory().Span); - fixed (byte* ptr = &MemoryMarshal.GetReference(span)) + fixed (byte* ptr = span) { byte* basePtr = ptr; for (int y = 0; y < buffer.Height; y++)