From 1920e28ed0313e998a2fae6735969ebfc1242c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Foidl?= Date: Mon, 13 Mar 2023 16:47:32 +0100 Subject: [PATCH] Revised Unsafe.Add to avoid the sign-extending move --- .../ColorSpaces/Companding/SRgbCompanding.cs | 4 +- .../Conversion/ColorSpaceConverter.CieLab.cs | 26 +- .../Conversion/ColorSpaceConverter.CieLch.cs | 26 +- .../ColorSpaceConverter.CieLchuv.cs | 26 +- .../Conversion/ColorSpaceConverter.CieLuv.cs | 26 +- .../Conversion/ColorSpaceConverter.CieXyy.cs | 26 +- .../Conversion/ColorSpaceConverter.CieXyz.cs | 26 +- .../Conversion/ColorSpaceConverter.Cmyk.cs | 26 +- .../Conversion/ColorSpaceConverter.Hsl.cs | 26 +- .../Conversion/ColorSpaceConverter.Hsv.cs | 26 +- .../ColorSpaceConverter.HunterLab.cs | 26 +- .../ColorSpaceConverter.LinearRgb.cs | 26 +- .../Conversion/ColorSpaceConverter.Lms.cs | 28 +- .../Conversion/ColorSpaceConverter.Rgb.cs | 26 +- .../Conversion/ColorSpaceConverter.YCbCr.cs | 24 +- .../VonKriesChromaticAdaptation.cs | 2 +- src/ImageSharp/Common/Helpers/Numerics.cs | 24 +- .../Helpers/Shuffle/IComponentShuffle.cs | 20 +- .../Common/Helpers/Shuffle/IPad3Shuffle4.cs | 12 +- .../Common/Helpers/Shuffle/IShuffle3.cs | 8 +- .../Common/Helpers/Shuffle/IShuffle4Slice3.cs | 14 +- .../SimdUtils.FallbackIntrinsics128.cs | 4 +- .../Common/Helpers/SimdUtils.HwIntrinsics.cs | 4 +- .../Common/Helpers/SimdUtils.Pack.cs | 18 +- .../Common/Helpers/SimdUtils.Shuffle.cs | 18 +- src/ImageSharp/Compression/Zlib/Crc32.cs | 2 +- .../Compression/Zlib/DeflaterHuffman.cs | 94 ++-- src/ImageSharp/Formats/Gif/GifDecoderCore.cs | 8 +- src/ImageSharp/Formats/Gif/GifEncoderCore.cs | 2 +- src/ImageSharp/Formats/Gif/LzwDecoder.cs | 38 +- src/ImageSharp/Formats/Gif/LzwEncoder.cs | 22 +- .../Formats/Jpeg/Components/Block8x8.cs | 10 +- .../Jpeg/Components/Block8x8F.Generated.cs | 18 +- .../Jpeg/Components/Block8x8F.Intrinsic.cs | 6 +- .../Jpeg/Components/Block8x8F.ScaledCopy.cs | 12 +- .../JpegColorConverter.GrayScaleScalar.cs | 2 +- .../Decoder/ArithmeticScanDecoder.cs | 4 +- .../Components/Decoder/HuffmanScanDecoder.cs | 12 +- .../Components/Encoder/ComponentProcessor.cs | 12 +- .../Components/Encoder/HuffmanScanEncoder.cs | 4 +- .../Formats/Png/Filters/AverageFilter.cs | 16 +- .../Formats/Png/Filters/PaethFilter.cs | 12 +- .../Formats/Png/Filters/SubFilter.cs | 14 +- .../Formats/Png/Filters/UpFilter.cs | 14 +- src/ImageSharp/Formats/Png/PngDecoderCore.cs | 4 +- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 14 +- .../Formats/Png/PngEncoderHelpers.cs | 6 +- .../Formats/Png/PngScanlineProcessor.cs | 110 ++--- .../Decompressors/T6TiffCompression.cs | 2 +- .../BlackIsZero1TiffColor{TPixel}.cs | 6 +- .../WhiteIsZero1TiffColor{TPixel}.cs | 6 +- src/ImageSharp/Formats/Webp/AlphaDecoder.cs | 11 +- .../Formats/Webp/Lossless/LosslessUtils.cs | 22 +- .../Formats/Webp/Lossless/Vp8LHistogram.cs | 29 +- .../Formats/Webp/Lossy/LossyUtils.cs | 114 ++--- src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs | 2 +- .../Formats/Webp/Lossy/YuvConversion.cs | 8 +- .../Allocators/Internals/ManagedBufferBase.cs | 2 +- .../DiscontiguousBuffers/MemoryGroup{T}.cs | 2 +- .../DefaultPixelBlenders.Generated.cs | 432 +++++++++--------- .../DefaultPixelBlenders.Generated.tt | 4 +- .../PixelImplementations/Abgr32.cs | 2 +- .../PixelImplementations/Bgr24.cs | 2 +- .../Abgr32.PixelOperations.Generated.cs | 14 +- .../Argb32.PixelOperations.Generated.cs | 14 +- .../Bgr24.PixelOperations.Generated.cs | 14 +- .../Bgra32.PixelOperations.Generated.cs | 14 +- .../Bgra5551.PixelOperations.Generated.cs | 24 +- .../L16.PixelOperations.Generated.cs | 24 +- .../Generated/L8.PixelOperations.Generated.cs | 24 +- .../La16.PixelOperations.Generated.cs | 6 +- .../Rgb24.PixelOperations.Generated.cs | 14 +- .../Rgb48.PixelOperations.Generated.cs | 24 +- .../Generated/_Common.ttinclude | 2 +- .../RgbaVector.PixelOperations.cs | 4 +- .../PixelOperations{TPixel}.Generated.cs | 52 +-- .../PixelOperations{TPixel}.Generated.tt | 4 +- .../PixelFormats/PixelOperations{TPixel}.cs | 4 +- .../Utils/Vector4Converters.Default.cs | 10 +- .../Convolution/BokehBlurProcessor.cs | 6 +- .../Convolution/BokehBlurProcessor{TPixel}.cs | 16 +- .../Convolution2DRowOperation{TPixel}.cs | 30 +- .../Convolution/Convolution2DState.cs | 4 +- .../Convolution2PassProcessor{TPixel}.cs | 30 +- .../ConvolutionProcessor{TPixel}.cs | 20 +- .../Convolution/ConvolutionState.cs | 4 +- .../EdgeDetectorCompassProcessor{TPixel}.cs | 4 +- .../Processors/Convolution/Kernel.cs | 6 +- .../Convolution/KernelSamplingMap.cs | 2 +- .../Convolution/MedianConvolutionState.cs | 4 +- .../Convolution/MedianRowOperation{TPixel}.cs | 14 +- .../Parameters/BokehBlurKernelDataProvider.cs | 16 +- .../Processors/Convolution/ReadOnlyKernel.cs | 2 +- .../Processors/Dithering/ErrorDither.cs | 6 +- .../Effects/OilPaintingProcessor{TPixel}.cs | 24 +- .../Filters/OpaqueProcessor{TPixel}.cs | 2 +- ...alizationSlidingWindowProcessor{TPixel}.cs | 10 +- .../AutoLevelProcessor{TPixel}.cs | 10 +- ...lHistogramEqualizationProcessor{TPixel}.cs | 6 +- .../GrayscaleLevelsRowOperation{TPixel}.cs | 4 +- .../HistogramEqualizationProcessor{TPixel}.cs | 8 +- .../Quantization/EuclideanPixelMap{TPixel}.cs | 4 +- .../Transforms/Resize/ResizeWorker.cs | 6 +- .../ImageSharp.Benchmarks/Bulk/FromVector4.cs | 2 +- .../Bulk/PremultiplyVector4.cs | 4 +- .../Bulk/UnPremultiplyVector4.cs | 4 +- .../BlockOperations/Block8x8F_CopyTo1x1.cs | 78 ++-- .../BlockOperations/Block8x8F_CopyTo2x2.cs | 68 +-- .../Jpeg/BlockOperations/Block8x8F_Round.cs | 8 +- .../PixelConversion_ConvertFromRgba32.cs | 10 +- .../PixelConversion_ConvertFromVector4.cs | 4 +- .../PixelConversion_ConvertToRgba32.cs | 4 +- ...vertToRgba32_AsPartOfCompositeOperation.cs | 4 +- .../PixelConversion_ConvertToVector4.cs | 4 +- ...ertToVector4_AsPartOfCompositeOperation.cs | 4 +- .../PixelConversion_PackFromRgbPlanes.cs | 6 +- .../PixelConversion_Rgba32_To_Argb32.cs | 12 +- .../PixelConversion_Rgba32_To_Bgra32.cs | 26 +- .../Vectorization/WidenBytesToUInt32.cs | 2 +- .../PorterDuffBulkVsSingleVector.cs | 2 +- .../Formats/Png/ReferenceImplementations.cs | 22 +- ...ConverterTests.ReferenceImplementations.cs | 6 +- .../PixelOperations/PixelOperationsTests.cs | 2 +- 123 files changed, 1166 insertions(+), 1164 deletions(-) diff --git a/src/ImageSharp/ColorSpaces/Companding/SRgbCompanding.cs b/src/ImageSharp/ColorSpaces/Companding/SRgbCompanding.cs index e776a0dc2..2a6fcb083 100644 --- a/src/ImageSharp/ColorSpaces/Companding/SRgbCompanding.cs +++ b/src/ImageSharp/ColorSpaces/Companding/SRgbCompanding.cs @@ -175,7 +175,7 @@ public static class SRgbCompanding // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 vectorsBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(vectors)); - ref Vector256 vectorsLast = ref Unsafe.Add(ref vectorsBase, (IntPtr)((uint)vectors.Length / 2u)); + ref Vector256 vectorsLast = ref Unsafe.Add(ref vectorsBase, (uint)vectors.Length / 2u); while (Unsafe.IsAddressLessThan(ref vectorsBase, ref vectorsLast)) { @@ -204,7 +204,7 @@ public static class SRgbCompanding Vector4 zero = Vector4.Zero; var scale = new Vector4(Scale); ref Vector4 vectorsBase = ref MemoryMarshal.GetReference(vectors); - ref Vector4 vectorsLast = ref Unsafe.Add(ref vectorsBase, vectors.Length); + ref Vector4 vectorsLast = ref Unsafe.Add(ref vectorsBase, (uint)vectors.Length); while (Unsafe.IsAddressLessThan(ref vectorsBase, ref vectorsLast)) { diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs index 721df3667..88343cbab 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs @@ -37,7 +37,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -70,7 +70,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -103,7 +103,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -136,7 +136,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -169,7 +169,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -201,7 +201,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -266,7 +266,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -299,7 +299,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -332,7 +332,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -365,7 +365,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -398,7 +398,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); @@ -431,7 +431,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref CieLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref CieLab dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs index da8e68b48..dcd6be185 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLch.cs @@ -36,7 +36,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -69,7 +69,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -102,7 +102,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -135,7 +135,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -168,7 +168,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -200,7 +200,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -233,7 +233,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -266,7 +266,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -299,7 +299,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -332,7 +332,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -365,7 +365,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -398,7 +398,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); @@ -431,7 +431,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref CieLch destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref CieLch dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs index 75e955e41..eb21394a0 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLchuv.cs @@ -36,7 +36,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -69,7 +69,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -102,7 +102,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -135,7 +135,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -168,7 +168,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -201,7 +201,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -267,7 +267,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -300,7 +300,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -333,7 +333,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -366,7 +366,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -399,7 +399,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); @@ -431,7 +431,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref CieLchuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref CieLchuv dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs index b04acc990..1b6735e62 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLuv.cs @@ -35,7 +35,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -67,7 +67,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -102,7 +102,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -134,7 +134,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -169,7 +169,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -201,7 +201,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -233,7 +233,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -265,7 +265,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -297,7 +297,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -329,7 +329,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -361,7 +361,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -393,7 +393,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); @@ -425,7 +425,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref CieLuv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref CieLuv dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieXyy.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieXyy.cs index a3851de9f..2b34e66f2 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieXyy.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieXyy.cs @@ -36,7 +36,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -69,7 +69,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -102,7 +102,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -135,7 +135,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -163,7 +163,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -196,7 +196,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -229,7 +229,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -262,7 +262,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -295,7 +295,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -328,7 +328,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -361,7 +361,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -394,7 +394,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); @@ -427,7 +427,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyy destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyy dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieXyz.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieXyz.cs index 124465522..1495a28b6 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieXyz.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieXyz.cs @@ -41,7 +41,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -76,7 +76,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -111,7 +111,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -146,7 +146,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -177,7 +177,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -210,7 +210,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -243,7 +243,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -277,7 +277,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -310,7 +310,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -345,7 +345,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -374,7 +374,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -407,7 +407,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); @@ -440,7 +440,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Cmyk.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Cmyk.cs index cadcc9e03..068583e82 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Cmyk.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Cmyk.cs @@ -36,7 +36,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -69,7 +69,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -102,7 +102,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -135,7 +135,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -168,7 +168,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -201,7 +201,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -267,7 +267,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -300,7 +300,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -333,7 +333,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -366,7 +366,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -394,7 +394,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); @@ -427,7 +427,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref Cmyk destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref Cmyk dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsl.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsl.cs index b763a3ebe..f40544b7a 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsl.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsl.cs @@ -36,7 +36,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -69,7 +69,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -102,7 +102,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -135,7 +135,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -168,7 +168,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -201,7 +201,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -267,7 +267,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -300,7 +300,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -333,7 +333,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -366,7 +366,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -394,7 +394,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); @@ -427,7 +427,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref Hsl destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref Hsl dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsv.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsv.cs index 4b4b9d007..8bd014ed9 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsv.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Hsv.cs @@ -36,7 +36,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -69,7 +69,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -102,7 +102,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -135,7 +135,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -168,7 +168,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -201,7 +201,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -267,7 +267,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -300,7 +300,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -333,7 +333,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -366,7 +366,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -394,7 +394,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); @@ -427,7 +427,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref Hsv destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref Hsv dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.HunterLab.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.HunterLab.cs index 01c040231..289059465 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.HunterLab.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.HunterLab.cs @@ -24,7 +24,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -45,7 +45,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -66,7 +66,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -87,7 +87,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -108,7 +108,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -129,7 +129,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -150,7 +150,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -171,7 +171,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -192,7 +192,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -213,7 +213,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -255,7 +255,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); @@ -276,7 +276,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref HunterLab destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref HunterLab dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.LinearRgb.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.LinearRgb.cs index 416274e00..897ec02a0 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.LinearRgb.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.LinearRgb.cs @@ -24,7 +24,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -45,7 +45,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -66,7 +66,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -87,7 +87,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -108,7 +108,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -129,7 +129,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -150,7 +150,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -171,7 +171,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -192,7 +192,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -213,7 +213,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -255,7 +255,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); @@ -276,7 +276,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref LinearRgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref LinearRgb dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs index e2870a6eb..291f3a5fa 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors. +// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.Runtime.CompilerServices; @@ -24,7 +24,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -45,7 +45,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -66,7 +66,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -87,7 +87,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -108,7 +108,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -129,7 +129,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -150,7 +150,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -171,7 +171,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -192,7 +192,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -213,7 +213,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -255,7 +255,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); @@ -276,7 +276,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref Lms destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref Lms dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Rgb.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Rgb.cs index 7346a28f3..557c29499 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Rgb.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Rgb.cs @@ -24,7 +24,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -45,7 +45,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -66,7 +66,7 @@ public partial class ColorSpaceConverter ref CieLchuv sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLchuv sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -87,7 +87,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -108,7 +108,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -129,7 +129,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -150,7 +150,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -171,7 +171,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -192,7 +192,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -213,7 +213,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -255,7 +255,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); @@ -276,7 +276,7 @@ public partial class ColorSpaceConverter ref YCbCr sourceRef = ref MemoryMarshal.GetReference(source); ref Rgb destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref YCbCr sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.YCbCr.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.YCbCr.cs index f267a0d89..8ea875a3d 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.YCbCr.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.YCbCr.cs @@ -24,7 +24,7 @@ public partial class ColorSpaceConverter ref CieLab sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLab sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -45,7 +45,7 @@ public partial class ColorSpaceConverter ref CieLch sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLch sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -66,7 +66,7 @@ public partial class ColorSpaceConverter ref CieLuv sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieLuv sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -87,7 +87,7 @@ public partial class ColorSpaceConverter ref CieXyy sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyy sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -108,7 +108,7 @@ public partial class ColorSpaceConverter ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -129,7 +129,7 @@ public partial class ColorSpaceConverter ref Cmyk sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Cmyk sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -150,7 +150,7 @@ public partial class ColorSpaceConverter ref Hsl sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsl sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -171,7 +171,7 @@ public partial class ColorSpaceConverter ref Hsv sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Hsv sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -192,7 +192,7 @@ public partial class ColorSpaceConverter ref HunterLab sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref HunterLab sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -213,7 +213,7 @@ public partial class ColorSpaceConverter ref LinearRgb sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref LinearRgb sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -234,7 +234,7 @@ public partial class ColorSpaceConverter ref Lms sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Lms sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); @@ -255,7 +255,7 @@ public partial class ColorSpaceConverter ref Rgb sourceRef = ref MemoryMarshal.GetReference(source); ref YCbCr destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb sp = ref Unsafe.Add(ref sourceRef, i); ref YCbCr dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/ColorSpaces/Conversion/Implementation/VonKriesChromaticAdaptation.cs b/src/ImageSharp/ColorSpaces/Conversion/Implementation/VonKriesChromaticAdaptation.cs index 7b9915c23..55ed41220 100644 --- a/src/ImageSharp/ColorSpaces/Conversion/Implementation/VonKriesChromaticAdaptation.cs +++ b/src/ImageSharp/ColorSpaces/Conversion/Implementation/VonKriesChromaticAdaptation.cs @@ -81,7 +81,7 @@ public sealed class VonKriesChromaticAdaptation : IChromaticAdaptation ref CieXyz sourceRef = ref MemoryMarshal.GetReference(source); ref CieXyz destRef = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref CieXyz sp = ref Unsafe.Add(ref sourceRef, i); ref CieXyz dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/Common/Helpers/Numerics.cs b/src/ImageSharp/Common/Helpers/Numerics.cs index 6fbd48f8c..876f6e1fe 100644 --- a/src/ImageSharp/Common/Helpers/Numerics.cs +++ b/src/ImageSharp/Common/Helpers/Numerics.cs @@ -297,7 +297,7 @@ internal static class Numerics if (remainder.Length > 0) { ref byte remainderStart = ref MemoryMarshal.GetReference(remainder); - ref byte remainderEnd = ref Unsafe.Add(ref remainderStart, remainder.Length); + ref byte remainderEnd = ref Unsafe.Add(ref remainderStart, (uint)remainder.Length); while (Unsafe.IsAddressLessThan(ref remainderStart, ref remainderEnd)) { @@ -322,7 +322,7 @@ internal static class Numerics if (remainder.Length > 0) { ref uint remainderStart = ref MemoryMarshal.GetReference(remainder); - ref uint remainderEnd = ref Unsafe.Add(ref remainderStart, remainder.Length); + ref uint remainderEnd = ref Unsafe.Add(ref remainderStart, (uint)remainder.Length); while (Unsafe.IsAddressLessThan(ref remainderStart, ref remainderEnd)) { @@ -347,7 +347,7 @@ internal static class Numerics if (remainder.Length > 0) { ref int remainderStart = ref MemoryMarshal.GetReference(remainder); - ref int remainderEnd = ref Unsafe.Add(ref remainderStart, remainder.Length); + ref int remainderEnd = ref Unsafe.Add(ref remainderStart, (uint)remainder.Length); while (Unsafe.IsAddressLessThan(ref remainderStart, ref remainderEnd)) { @@ -372,7 +372,7 @@ internal static class Numerics if (remainder.Length > 0) { ref float remainderStart = ref MemoryMarshal.GetReference(remainder); - ref float remainderEnd = ref Unsafe.Add(ref remainderStart, remainder.Length); + ref float remainderEnd = ref Unsafe.Add(ref remainderStart, (uint)remainder.Length); while (Unsafe.IsAddressLessThan(ref remainderStart, ref remainderEnd)) { @@ -397,7 +397,7 @@ internal static class Numerics if (remainder.Length > 0) { ref double remainderStart = ref MemoryMarshal.GetReference(remainder); - ref double remainderEnd = ref Unsafe.Add(ref remainderStart, remainder.Length); + ref double remainderEnd = ref Unsafe.Add(ref remainderStart, (uint)remainder.Length); while (Unsafe.IsAddressLessThan(ref remainderStart, ref remainderEnd)) { @@ -497,7 +497,7 @@ internal static class Numerics { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 vectorsBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(vectors)); - ref Vector256 vectorsLast = ref Unsafe.Add(ref vectorsBase, (IntPtr)((uint)vectors.Length / 2u)); + ref Vector256 vectorsLast = ref Unsafe.Add(ref vectorsBase, (uint)vectors.Length / 2u); while (Unsafe.IsAddressLessThan(ref vectorsBase, ref vectorsLast)) { @@ -516,7 +516,7 @@ internal static class Numerics else { ref Vector4 vectorsStart = ref MemoryMarshal.GetReference(vectors); - ref Vector4 vectorsEnd = ref Unsafe.Add(ref vectorsStart, vectors.Length); + ref Vector4 vectorsEnd = ref Unsafe.Add(ref vectorsStart, (uint)vectors.Length); while (Unsafe.IsAddressLessThan(ref vectorsStart, ref vectorsEnd)) { @@ -562,7 +562,7 @@ internal static class Numerics { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 vectorsBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(vectors)); - ref Vector256 vectorsLast = ref Unsafe.Add(ref vectorsBase, (IntPtr)((uint)vectors.Length / 2u)); + ref Vector256 vectorsLast = ref Unsafe.Add(ref vectorsBase, (uint)vectors.Length / 2u); Vector256 epsilon = Vector256.Create(Constants.Epsilon); while (Unsafe.IsAddressLessThan(ref vectorsBase, ref vectorsLast)) @@ -582,7 +582,7 @@ internal static class Numerics else { ref Vector4 vectorsStart = ref MemoryMarshal.GetReference(vectors); - ref Vector4 vectorsEnd = ref Unsafe.Add(ref vectorsStart, vectors.Length); + ref Vector4 vectorsEnd = ref Unsafe.Add(ref vectorsStart, (uint)vectors.Length); while (Unsafe.IsAddressLessThan(ref vectorsStart, ref vectorsEnd)) { @@ -656,7 +656,7 @@ internal static class Numerics public static unsafe void CubePowOnXYZ(Span vectors) { ref Vector4 baseRef = ref MemoryMarshal.GetReference(vectors); - ref Vector4 endRef = ref Unsafe.Add(ref baseRef, vectors.Length); + ref Vector4 endRef = ref Unsafe.Add(ref baseRef, (uint)vectors.Length); while (Unsafe.IsAddressLessThan(ref baseRef, ref endRef)) { @@ -687,7 +687,7 @@ internal static class Numerics if (Sse41.IsSupported) { ref Vector128 vectors128Ref = ref Unsafe.As>(ref MemoryMarshal.GetReference(vectors)); - ref Vector128 vectors128End = ref Unsafe.Add(ref vectors128Ref, vectors.Length); + ref Vector128 vectors128End = ref Unsafe.Add(ref vectors128Ref, (uint)vectors.Length); var v128_341 = Vector128.Create(341); Vector128 v128_negativeZero = Vector128.Create(-0.0f).AsInt32(); @@ -736,7 +736,7 @@ internal static class Numerics else { ref Vector4 vectorsRef = ref MemoryMarshal.GetReference(vectors); - ref Vector4 vectorsEnd = ref Unsafe.Add(ref vectorsRef, vectors.Length); + ref Vector4 vectorsEnd = ref Unsafe.Add(ref vectorsRef, (uint)vectors.Length); // Fallback with scalar preprocessing and vectorized approximation steps while (Unsafe.IsAddressLessThan(ref vectorsRef, ref vectorsEnd)) diff --git a/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs b/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs index 9b73eb6cc..18daaed48 100644 --- a/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs +++ b/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs @@ -63,12 +63,12 @@ internal readonly struct DefaultShuffle4 : IShuffle4 Shuffle.InverseMMShuffle(this.Control, out int p3, out int p2, out int p1, out int p0); - for (int i = 0; i < source.Length; i += 4) + for (nint i = 0; i < (uint)source.Length; i += 4) { - Unsafe.Add(ref dBase, i) = Unsafe.Add(ref sBase, p0 + i); - Unsafe.Add(ref dBase, i + 1) = Unsafe.Add(ref sBase, p1 + i); - Unsafe.Add(ref dBase, i + 2) = Unsafe.Add(ref sBase, p2 + i); - Unsafe.Add(ref dBase, i + 3) = Unsafe.Add(ref sBase, p3 + i); + Unsafe.Add(ref dBase, i + 0) = Unsafe.Add(ref sBase, (nint)(uint)p0 + i); + Unsafe.Add(ref dBase, i + 1) = Unsafe.Add(ref sBase, (nint)(uint)p1 + i); + Unsafe.Add(ref dBase, i + 2) = Unsafe.Add(ref sBase, (nint)(uint)p2 + i); + Unsafe.Add(ref dBase, i + 3) = Unsafe.Add(ref sBase, (nint)(uint)p3 + i); } } } @@ -86,7 +86,7 @@ internal readonly struct WXYZShuffle4 : IShuffle4 ref uint dBase = ref Unsafe.As(ref MemoryMarshal.GetReference(dest)); int n = source.Length / 4; - for (int i = 0; i < n; i++) + for (nint i = 0; i < (uint)n; i++) { uint packed = Unsafe.Add(ref sBase, i); @@ -110,7 +110,7 @@ internal readonly struct WZYXShuffle4 : IShuffle4 ref uint dBase = ref Unsafe.As(ref MemoryMarshal.GetReference(dest)); int n = source.Length / 4; - for (int i = 0; i < n; i++) + for (nint i = 0; i < (uint)n; i++) { uint packed = Unsafe.Add(ref sBase, i); @@ -134,7 +134,7 @@ internal readonly struct YZWXShuffle4 : IShuffle4 ref uint dBase = ref Unsafe.As(ref MemoryMarshal.GetReference(dest)); int n = source.Length / 4; - for (int i = 0; i < n; i++) + for (nint i = 0; i < (uint)n; i++) { uint packed = Unsafe.Add(ref sBase, i); @@ -158,7 +158,7 @@ internal readonly struct ZYXWShuffle4 : IShuffle4 ref uint dBase = ref Unsafe.As(ref MemoryMarshal.GetReference(dest)); int n = source.Length / 4; - for (int i = 0; i < n; i++) + for (nint i = 0; i < (uint)n; i++) { uint packed = Unsafe.Add(ref sBase, i); @@ -189,7 +189,7 @@ internal readonly struct XWZYShuffle4 : IShuffle4 ref uint dBase = ref Unsafe.As(ref MemoryMarshal.GetReference(dest)); int n = source.Length / 4; - for (int i = 0; i < n; i++) + for (nint i = 0; i < (uint)n; i++) { uint packed = Unsafe.Add(ref sBase, i); diff --git a/src/ImageSharp/Common/Helpers/Shuffle/IPad3Shuffle4.cs b/src/ImageSharp/Common/Helpers/Shuffle/IPad3Shuffle4.cs index 5dfdd9171..3e1084d31 100644 --- a/src/ImageSharp/Common/Helpers/Shuffle/IPad3Shuffle4.cs +++ b/src/ImageSharp/Common/Helpers/Shuffle/IPad3Shuffle4.cs @@ -35,15 +35,15 @@ internal readonly struct DefaultPad3Shuffle4 : IPad3Shuffle4 ref byte t = ref MemoryMarshal.GetReference(temp); ref uint tu = ref Unsafe.As(ref t); - for (int i = 0, j = 0; i < source.Length; i += 3, j += 4) + for (nint i = 0, j = 0; i < (uint)source.Length; i += 3, j += 4) { ref byte s = ref Unsafe.Add(ref sBase, i); tu = Unsafe.As(ref s) | 0xFF000000; - Unsafe.Add(ref dBase, j) = Unsafe.Add(ref t, p0); - Unsafe.Add(ref dBase, j + 1) = Unsafe.Add(ref t, p1); - Unsafe.Add(ref dBase, j + 2) = Unsafe.Add(ref t, p2); - Unsafe.Add(ref dBase, j + 3) = Unsafe.Add(ref t, p3); + Unsafe.Add(ref dBase, j + 0) = Unsafe.Add(ref t, (uint)p0); + Unsafe.Add(ref dBase, j + 1) = Unsafe.Add(ref t, (uint)p1); + Unsafe.Add(ref dBase, j + 2) = Unsafe.Add(ref t, (uint)p2); + Unsafe.Add(ref dBase, j + 3) = Unsafe.Add(ref t, (uint)p3); } } } @@ -60,7 +60,7 @@ internal readonly struct XYZWPad3Shuffle4 : IPad3Shuffle4 ref byte sBase = ref MemoryMarshal.GetReference(source); ref byte dBase = ref MemoryMarshal.GetReference(dest); - ref byte sEnd = ref Unsafe.Add(ref sBase, source.Length); + ref byte sEnd = ref Unsafe.Add(ref sBase, (uint)source.Length); ref byte sLoopEnd = ref Unsafe.Subtract(ref sEnd, 4); while (Unsafe.IsAddressLessThan(ref sBase, ref sLoopEnd)) diff --git a/src/ImageSharp/Common/Helpers/Shuffle/IShuffle3.cs b/src/ImageSharp/Common/Helpers/Shuffle/IShuffle3.cs index 6bf8c5f03..b149bde09 100644 --- a/src/ImageSharp/Common/Helpers/Shuffle/IShuffle3.cs +++ b/src/ImageSharp/Common/Helpers/Shuffle/IShuffle3.cs @@ -31,11 +31,11 @@ internal readonly struct DefaultShuffle3 : IShuffle3 Shuffle.InverseMMShuffle(this.Control, out _, out int p2, out int p1, out int p0); - for (int i = 0; i < source.Length; i += 3) + for (nint i = 0; i < (uint)source.Length; i += 3) { - Unsafe.Add(ref dBase, i) = Unsafe.Add(ref sBase, p0 + i); - Unsafe.Add(ref dBase, i + 1) = Unsafe.Add(ref sBase, p1 + i); - Unsafe.Add(ref dBase, i + 2) = Unsafe.Add(ref sBase, p2 + i); + Unsafe.Add(ref dBase, i + 0) = Unsafe.Add(ref sBase, (nint)(uint)p0 + i); + Unsafe.Add(ref dBase, i + 1) = Unsafe.Add(ref sBase, (nint)(uint)p1 + i); + Unsafe.Add(ref dBase, i + 2) = Unsafe.Add(ref sBase, (nint)(uint)p2 + i); } } } diff --git a/src/ImageSharp/Common/Helpers/Shuffle/IShuffle4Slice3.cs b/src/ImageSharp/Common/Helpers/Shuffle/IShuffle4Slice3.cs index ef46661f5..1f12cea25 100644 --- a/src/ImageSharp/Common/Helpers/Shuffle/IShuffle4Slice3.cs +++ b/src/ImageSharp/Common/Helpers/Shuffle/IShuffle4Slice3.cs @@ -31,11 +31,11 @@ internal readonly struct DefaultShuffle4Slice3 : IShuffle4Slice3 Shuffle.InverseMMShuffle(this.Control, out _, out int p2, out int p1, out int p0); - for (int i = 0, j = 0; i < dest.Length; i += 3, j += 4) + for (nint i = 0, j = 0; i < (uint)dest.Length; i += 3, j += 4) { - Unsafe.Add(ref dBase, i) = Unsafe.Add(ref sBase, p0 + j); - Unsafe.Add(ref dBase, i + 1) = Unsafe.Add(ref sBase, p1 + j); - Unsafe.Add(ref dBase, i + 2) = Unsafe.Add(ref sBase, p2 + j); + Unsafe.Add(ref dBase, i + 0) = Unsafe.Add(ref sBase, (nint)(uint)p0 + j); + Unsafe.Add(ref dBase, i + 1) = Unsafe.Add(ref sBase, (nint)(uint)p1 + j); + Unsafe.Add(ref dBase, i + 2) = Unsafe.Add(ref sBase, (nint)(uint)p2 + j); } } } @@ -52,9 +52,9 @@ internal readonly struct XYZWShuffle4Slice3 : IShuffle4Slice3 ref uint sBase = ref Unsafe.As(ref MemoryMarshal.GetReference(source)); ref Byte3 dBase = ref Unsafe.As(ref MemoryMarshal.GetReference(dest)); - int n = source.Length / 4; - int m = Numerics.Modulo4(n); - int u = n - m; + nint n = (nint)(uint)source.Length / 4; + nint m = Numerics.Modulo4(n); + nint u = n - m; ref uint sLoopEnd = ref Unsafe.Add(ref sBase, u); ref uint sEnd = ref Unsafe.Add(ref sBase, n); diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.FallbackIntrinsics128.cs b/src/ImageSharp/Common/Helpers/SimdUtils.FallbackIntrinsics128.cs index 84760f281..8c79b181c 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.FallbackIntrinsics128.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.FallbackIntrinsics128.cs @@ -83,7 +83,7 @@ internal static partial class SimdUtils const float scale = 1f / 255f; Vector4 d = default; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref ByteVector4 s = ref Unsafe.Add(ref sBase, i); d.X = s.X; @@ -117,7 +117,7 @@ internal static partial class SimdUtils var half = new Vector4(0.5f); var maxBytes = new Vector4(255f); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Vector4 s = Unsafe.Add(ref sBase, i); s *= maxBytes; diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs index a82b5559c..654ae3810 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs @@ -995,9 +995,9 @@ internal static partial class SimdUtils const int bytesPerRgbStride = 24; int count = (int)((uint)source.Length / 8); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { - rgb = Avx2.PermuteVar8x32(Unsafe.AddByteOffset(ref rgbByteSpan, (IntPtr)(bytesPerRgbStride * i)).AsUInt32(), extractToLanesMask).AsByte(); + rgb = Avx2.PermuteVar8x32(Unsafe.AddByteOffset(ref rgbByteSpan, (uint)(bytesPerRgbStride * i)).AsUInt32(), extractToLanesMask).AsByte(); rgb = Avx2.Shuffle(rgb, extractRgbMask); diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs index a01a32f5e..ff8323df0 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs @@ -86,8 +86,8 @@ internal static partial class SimdUtils ref ByteTuple4 b = ref Unsafe.As(ref MemoryMarshal.GetReference(blueChannel)); ref Rgb24 rgb = ref MemoryMarshal.GetReference(destination); - int count = redChannel.Length / 4; - for (int i = 0; i < count; i++) + uint count = (uint)redChannel.Length / 4; + for (nint i = 0; i < count; i++) { ref Rgb24 d0 = ref Unsafe.Add(ref rgb, i * 4); ref Rgb24 d1 = ref Unsafe.Add(ref d0, 1); @@ -115,7 +115,7 @@ internal static partial class SimdUtils d3.B = bb.V3; } - int finished = count * 4; + int finished = (int)(count * 4); redChannel = redChannel[finished..]; greenChannel = greenChannel[finished..]; blueChannel = blueChannel[finished..]; @@ -133,9 +133,9 @@ internal static partial class SimdUtils ref ByteTuple4 b = ref Unsafe.As(ref MemoryMarshal.GetReference(blueChannel)); ref Rgba32 rgb = ref MemoryMarshal.GetReference(destination); - int count = redChannel.Length / 4; + uint count = (uint)redChannel.Length / 4; destination.Fill(new Rgba32(0, 0, 0, 255)); - for (int i = 0; i < count; i++) + for (nint i = 0; i < count; i++) { ref Rgba32 d0 = ref Unsafe.Add(ref rgb, i * 4); ref Rgba32 d1 = ref Unsafe.Add(ref d0, 1); @@ -163,7 +163,7 @@ internal static partial class SimdUtils d3.B = bb.V3; } - int finished = count * 4; + int finished = (int)(count * 4); redChannel = redChannel[finished..]; greenChannel = greenChannel[finished..]; blueChannel = blueChannel[finished..]; @@ -181,7 +181,7 @@ internal static partial class SimdUtils ref byte b = ref MemoryMarshal.GetReference(blueChannel); ref Rgb24 rgb = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < destination.Length; i++) + for (nint i = 0; i < (uint)destination.Length; i++) { ref Rgb24 d = ref Unsafe.Add(ref rgb, i); d.R = Unsafe.Add(ref r, i); @@ -201,7 +201,7 @@ internal static partial class SimdUtils ref byte b = ref MemoryMarshal.GetReference(blueChannel); ref Rgba32 rgba = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < destination.Length; i++) + for (nint i = 0; i < (uint)destination.Length; i++) { ref Rgba32 d = ref Unsafe.Add(ref rgba, i); d.R = Unsafe.Add(ref r, i); @@ -226,7 +226,7 @@ internal static partial class SimdUtils ref float b = ref MemoryMarshal.GetReference(blueChannel); ref Rgb24 rgb = ref MemoryMarshal.GetReference(source); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Rgb24 src = ref Unsafe.Add(ref rgb, i); Unsafe.Add(ref r, i) = src.R; diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs b/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs index aecdaa639..532f9d4fa 100644 --- a/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs +++ b/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs @@ -147,12 +147,12 @@ internal static partial class SimdUtils ref float dBase = ref MemoryMarshal.GetReference(dest); Shuffle.InverseMMShuffle(control, out int p3, out int p2, out int p1, out int p0); - for (int i = 0; i < source.Length; i += 4) + for (nint i = 0; i < (uint)source.Length; i += 4) { - Unsafe.Add(ref dBase, i) = Unsafe.Add(ref sBase, p0 + i); - Unsafe.Add(ref dBase, i + 1) = Unsafe.Add(ref sBase, p1 + i); - Unsafe.Add(ref dBase, i + 2) = Unsafe.Add(ref sBase, p2 + i); - Unsafe.Add(ref dBase, i + 3) = Unsafe.Add(ref sBase, p3 + i); + Unsafe.Add(ref dBase, i + 0) = Unsafe.Add(ref sBase, (nint)(uint)p0 + i); + Unsafe.Add(ref dBase, i + 1) = Unsafe.Add(ref sBase, (nint)(uint)p1 + i); + Unsafe.Add(ref dBase, i + 2) = Unsafe.Add(ref sBase, (nint)(uint)p2 + i); + Unsafe.Add(ref dBase, i + 3) = Unsafe.Add(ref sBase, (nint)(uint)p3 + i); } } @@ -501,10 +501,10 @@ internal static partial class SimdUtils for (int i = 0; i < span.Length; i += 4) { - Unsafe.Add(ref spanBase, i) = (byte)(p0 + i); - Unsafe.Add(ref spanBase, i + 1) = (byte)(p1 + i); - Unsafe.Add(ref spanBase, i + 2) = (byte)(p2 + i); - Unsafe.Add(ref spanBase, i + 3) = (byte)(p3 + i); + Unsafe.Add(ref spanBase, (uint)(i + 0)) = (byte)(p0 + i); + Unsafe.Add(ref spanBase, (uint)(i + 1)) = (byte)(p1 + i); + Unsafe.Add(ref spanBase, (uint)(i + 2)) = (byte)(p2 + i); + Unsafe.Add(ref spanBase, (uint)(i + 3)) = (byte)(p3 + i); } } diff --git a/src/ImageSharp/Compression/Zlib/Crc32.cs b/src/ImageSharp/Compression/Zlib/Crc32.cs index 39c535c77..2d0a09bd4 100644 --- a/src/ImageSharp/Compression/Zlib/Crc32.cs +++ b/src/ImageSharp/Compression/Zlib/Crc32.cs @@ -300,7 +300,7 @@ internal static partial class Crc32 for (int i = 0; i < buffer.Length; i++) { - crc = Unsafe.Add(ref crcTableRef, (int)((crc ^ Unsafe.Add(ref bufferRef, i)) & 0xFF)) ^ (crc >> 8); + crc = Unsafe.Add(ref crcTableRef, (crc ^ Unsafe.Add(ref bufferRef, i)) & 0xFF) ^ (crc >> 8); } return crc; diff --git a/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs b/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs index dc11de425..d507d88c5 100644 --- a/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs +++ b/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs @@ -286,13 +286,13 @@ internal sealed unsafe class DeflaterHuffman : IDisposable int static_len = this.extraBits; ref byte staticLLengthRef = ref MemoryMarshal.GetReference(StaticLLength); - for (int i = 0; i < LiteralNumber; i++) + for (nint i = 0; i < LiteralNumber; i++) { static_len += this.literalTree.Frequencies[i] * Unsafe.Add(ref staticLLengthRef, i); } ref byte staticDLengthRef = ref MemoryMarshal.GetReference(StaticDLength); - for (int i = 0; i < DistanceNumber; i++) + for (nint i = 0; i < DistanceNumber; i++) { static_len += this.distTree.Frequencies[i] * Unsafe.Add(ref staticDLengthRef, i); } @@ -405,10 +405,10 @@ internal sealed unsafe class DeflaterHuffman : IDisposable ref byte bit4ReverseRef = ref MemoryMarshal.GetReference(Bit4Reverse); - return (short)(Unsafe.Add(ref bit4ReverseRef, toReverse & 0xF) << 12 - | Unsafe.Add(ref bit4ReverseRef, (toReverse >> 4) & 0xF) << 8 - | Unsafe.Add(ref bit4ReverseRef, (toReverse >> 8) & 0xF) << 4 - | Unsafe.Add(ref bit4ReverseRef, toReverseRightShiftBy12)); + return (short)((Unsafe.Add(ref bit4ReverseRef, (uint)toReverse & 0xF) << 12) + | (Unsafe.Add(ref bit4ReverseRef, (uint)(toReverse >> 4) & 0xF) << 8) + | (Unsafe.Add(ref bit4ReverseRef, (uint)(toReverse >> 8) & 0xF) << 4) + | Unsafe.Add(ref bit4ReverseRef, (uint)toReverseRightShiftBy12)); } /// @@ -551,8 +551,8 @@ internal sealed unsafe class DeflaterHuffman : IDisposable int code = 0; for (int bits = 0; bits < this.maxLength; bits++) { - Unsafe.Add(ref nextCodeRef, bits) = code; - code += Unsafe.Add(ref bitLengthCountsRef, bits) << (15 - bits); + Unsafe.Add(ref nextCodeRef, (uint)bits) = code; + code += Unsafe.Add(ref bitLengthCountsRef, (uint)bits) << (15 - bits); } for (int i = 0; i < this.NumCodes; i++) @@ -560,8 +560,8 @@ internal sealed unsafe class DeflaterHuffman : IDisposable int bits = this.Length[i]; if (bits > 0) { - this.codes[i] = BitReverse(Unsafe.Add(ref nextCodeRef, bits - 1)); - Unsafe.Add(ref nextCodeRef, bits - 1) += 1 << (16 - bits); + this.codes[i] = BitReverse(Unsafe.Add(ref nextCodeRef, (uint)(bits - 1))); + Unsafe.Add(ref nextCodeRef, (uint)(bits - 1)) += 1 << (16 - bits); } } } @@ -593,13 +593,13 @@ internal sealed unsafe class DeflaterHuffman : IDisposable // Insert n into heap int pos = heapLen++; int ppos; - while (pos > 0 && this.Frequencies[Unsafe.Add(ref heapRef, ppos = (pos - 1) >> 1)] > freq) + while (pos > 0 && this.Frequencies[Unsafe.Add(ref heapRef, (uint)(ppos = (pos - 1) >> 1))] > freq) { - Unsafe.Add(ref heapRef, pos) = Unsafe.Add(ref heapRef, ppos); + Unsafe.Add(ref heapRef, pos) = Unsafe.Add(ref heapRef, (uint)ppos); pos = ppos; } - Unsafe.Add(ref heapRef, pos) = n; + Unsafe.Add(ref heapRef, (uint)pos) = n; maxCode = n; } @@ -611,7 +611,7 @@ internal sealed unsafe class DeflaterHuffman : IDisposable // this case, both literals get a 1 bit code. while (heapLen < 2) { - Unsafe.Add(ref heapRef, heapLen++) = maxCode < 2 ? ++maxCode : 0; + Unsafe.Add(ref heapRef, (uint)heapLen++) = maxCode < 2 ? ++maxCode : 0; } this.NumCodes = Math.Max(maxCode + 1, this.minNumCodes); @@ -625,14 +625,14 @@ internal sealed unsafe class DeflaterHuffman : IDisposable ref int valuesRef = ref MemoryMarshal.GetReference(valuesMemoryOwner.Memory.Span); int numNodes = numLeafs; - for (int i = 0; i < heapLen; i++) + for (nint i = 0; i < (uint)heapLen; i++) { int node = Unsafe.Add(ref heapRef, i); - int i2 = 2 * i; + nint i2 = 2 * i; Unsafe.Add(ref childrenRef, i2) = node; Unsafe.Add(ref childrenRef, i2 + 1) = -1; Unsafe.Add(ref valuesRef, i) = this.Frequencies[node] << 8; - Unsafe.Add(ref heapRef, i) = i; + Unsafe.Add(ref heapRef, i) = (int)i; } // Construct the Huffman tree by repeatedly combining the least two @@ -640,7 +640,7 @@ internal sealed unsafe class DeflaterHuffman : IDisposable do { int first = Unsafe.Add(ref heapRef, 0); - int last = Unsafe.Add(ref heapRef, --heapLen); + int last = Unsafe.Add(ref heapRef, (uint)--heapLen); // Propagate the hole to the leafs of the heap int ppos = 0; @@ -648,35 +648,35 @@ internal sealed unsafe class DeflaterHuffman : IDisposable while (path < heapLen) { - if (path + 1 < heapLen && Unsafe.Add(ref valuesRef, Unsafe.Add(ref heapRef, path)) > Unsafe.Add(ref valuesRef, Unsafe.Add(ref heapRef, path + 1))) + if (path + 1 < heapLen && Unsafe.Add(ref valuesRef, (uint)Unsafe.Add(ref heapRef, (uint)path)) > Unsafe.Add(ref valuesRef, (uint)Unsafe.Add(ref heapRef, (uint)(path + 1)))) { path++; } - Unsafe.Add(ref heapRef, ppos) = Unsafe.Add(ref heapRef, path); + Unsafe.Add(ref heapRef, (uint)ppos) = Unsafe.Add(ref heapRef, (uint)path); ppos = path; path = (path * 2) + 1; } // Now propagate the last element down along path. Normally // it shouldn't go too deep. - int lastVal = Unsafe.Add(ref valuesRef, last); + int lastVal = Unsafe.Add(ref valuesRef, (uint)last); while ((path = ppos) > 0 - && Unsafe.Add(ref valuesRef, Unsafe.Add(ref heapRef, ppos = (path - 1) >> 1)) > lastVal) + && Unsafe.Add(ref valuesRef, (uint)Unsafe.Add(ref heapRef, (uint)(ppos = (path - 1) >> 1))) > lastVal) { - Unsafe.Add(ref heapRef, path) = Unsafe.Add(ref heapRef, ppos); + Unsafe.Add(ref heapRef, (uint)path) = Unsafe.Add(ref heapRef, (uint)ppos); } - Unsafe.Add(ref heapRef, path) = last; + Unsafe.Add(ref heapRef, (uint)path) = last; int second = Unsafe.Add(ref heapRef, 0); // Create a new node father of first and second last = numNodes++; - Unsafe.Add(ref childrenRef, 2 * last) = first; - Unsafe.Add(ref childrenRef, (2 * last) + 1) = second; - int mindepth = Math.Min(Unsafe.Add(ref valuesRef, first) & 0xFF, Unsafe.Add(ref valuesRef, second) & 0xFF); - Unsafe.Add(ref valuesRef, last) = lastVal = Unsafe.Add(ref valuesRef, first) + Unsafe.Add(ref valuesRef, second) - mindepth + 1; + Unsafe.Add(ref childrenRef, (uint)(2 * last)) = first; + Unsafe.Add(ref childrenRef, (uint)((2 * last) + 1)) = second; + int mindepth = Math.Min(Unsafe.Add(ref valuesRef, (uint)first) & 0xFF, Unsafe.Add(ref valuesRef, (uint)second) & 0xFF); + Unsafe.Add(ref valuesRef, (uint)last) = lastVal = Unsafe.Add(ref valuesRef, (uint)first) + Unsafe.Add(ref valuesRef, (uint)second) - mindepth + 1; // Again, propagate the hole to the leafs ppos = 0; @@ -685,23 +685,23 @@ internal sealed unsafe class DeflaterHuffman : IDisposable while (path < heapLen) { if (path + 1 < heapLen - && Unsafe.Add(ref valuesRef, Unsafe.Add(ref heapRef, path)) > Unsafe.Add(ref valuesRef, Unsafe.Add(ref heapRef, path + 1))) + && Unsafe.Add(ref valuesRef, (uint)Unsafe.Add(ref heapRef, (uint)path)) > Unsafe.Add(ref valuesRef, (uint)Unsafe.Add(ref heapRef, (uint)(path + 1)))) { path++; } - Unsafe.Add(ref heapRef, ppos) = Unsafe.Add(ref heapRef, path); + Unsafe.Add(ref heapRef, (uint)ppos) = Unsafe.Add(ref heapRef, (uint)path); ppos = path; path = (ppos * 2) + 1; } // Now propagate the new element down along path - while ((path = ppos) > 0 && Unsafe.Add(ref valuesRef, Unsafe.Add(ref heapRef, ppos = (path - 1) >> 1)) > lastVal) + while ((path = ppos) > 0 && Unsafe.Add(ref valuesRef, (uint)Unsafe.Add(ref heapRef, (uint)(ppos = (path - 1) >> 1))) > lastVal) { - Unsafe.Add(ref heapRef, path) = Unsafe.Add(ref heapRef, ppos); + Unsafe.Add(ref heapRef, (uint)path) = Unsafe.Add(ref heapRef, (uint)ppos); } - Unsafe.Add(ref heapRef, path) = last; + Unsafe.Add(ref heapRef, (uint)path) = last; } while (heapLen > 1); @@ -886,21 +886,21 @@ internal sealed unsafe class DeflaterHuffman : IDisposable { if (children[(2 * i) + 1] != -1) { - int bitLength = Unsafe.Add(ref lengthsRef, i) + 1; + int bitLength = Unsafe.Add(ref lengthsRef, (uint)i) + 1; if (bitLength > maxLen) { bitLength = maxLen; overflow++; } - Unsafe.Add(ref lengthsRef, Unsafe.Add(ref childrenRef, 2 * i)) = Unsafe.Add(ref lengthsRef, Unsafe.Add(ref childrenRef, (2 * i) + 1)) = bitLength; + Unsafe.Add(ref lengthsRef, (uint)Unsafe.Add(ref childrenRef, (uint)(2 * i))) = Unsafe.Add(ref lengthsRef, (uint)Unsafe.Add(ref childrenRef, (uint)((2 * i) + 1))) = bitLength; } else { // A leaf node - int bitLength = Unsafe.Add(ref lengthsRef, i); - Unsafe.Add(ref bitLengthCountsRef, bitLength - 1)++; - lengthPtr[Unsafe.Add(ref childrenRef, 2 * i)] = (byte)Unsafe.Add(ref lengthsRef, i); + int bitLength = Unsafe.Add(ref lengthsRef, (uint)i); + Unsafe.Add(ref bitLengthCountsRef, (uint)(bitLength - 1))++; + lengthPtr[Unsafe.Add(ref childrenRef, (uint)(2 * i))] = (byte)Unsafe.Add(ref lengthsRef, (uint)i); } } } @@ -914,7 +914,7 @@ internal sealed unsafe class DeflaterHuffman : IDisposable do { // Find the first bit length which could increase: - while (Unsafe.Add(ref bitLengthCountsRef, --incrBitLen) == 0) + while (Unsafe.Add(ref bitLengthCountsRef, (uint)--incrBitLen) == 0) { } @@ -922,8 +922,8 @@ internal sealed unsafe class DeflaterHuffman : IDisposable // number of overflow nodes. do { - Unsafe.Add(ref bitLengthCountsRef, incrBitLen)--; - Unsafe.Add(ref bitLengthCountsRef, ++incrBitLen)++; + Unsafe.Add(ref bitLengthCountsRef, (uint)incrBitLen)--; + Unsafe.Add(ref bitLengthCountsRef, (uint)++incrBitLen)++; overflow -= 1 << (maxLen - 1 - incrBitLen); } while (overflow > 0 && incrBitLen < maxLen - 1); @@ -932,8 +932,8 @@ internal sealed unsafe class DeflaterHuffman : IDisposable // We may have overshot above. Move some nodes from maxLength to // maxLength-1 in that case. - Unsafe.Add(ref bitLengthCountsRef, maxLen - 1) += overflow; - Unsafe.Add(ref bitLengthCountsRef, maxLen - 2) -= overflow; + Unsafe.Add(ref bitLengthCountsRef, (uint)(maxLen - 1)) += overflow; + Unsafe.Add(ref bitLengthCountsRef, (uint)(maxLen - 2)) -= overflow; // Now recompute all bit lengths, scanning in increasing // frequency. It is simpler to reconstruct all lengths instead of @@ -945,14 +945,14 @@ internal sealed unsafe class DeflaterHuffman : IDisposable int nodeIndex = 2 * numLeafs; for (int bits = maxLen; bits != 0; bits--) { - int n = Unsafe.Add(ref bitLengthCountsRef, bits - 1); + int n = Unsafe.Add(ref bitLengthCountsRef, (uint)(bits - 1)); while (n > 0) { - int childIndex = 2 * Unsafe.Add(ref childrenRef, nodeIndex++); - if (Unsafe.Add(ref childrenRef, childIndex + 1) == -1) + int childIndex = 2 * Unsafe.Add(ref childrenRef, (uint)nodeIndex++); + if (Unsafe.Add(ref childrenRef, (uint)(childIndex + 1)) == -1) { // We found another leaf - lengthPtr[Unsafe.Add(ref childrenRef, childIndex)] = (byte)bits; + lengthPtr[Unsafe.Add(ref childrenRef, (uint)childIndex)] = (byte)bits; n--; } } diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs index 17b5d8ec9..6ff2723dd 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs @@ -578,8 +578,8 @@ internal sealed class GifDecoderCore : IImageDecoderInternals // #403 The left + width value can be larger than the image width for (int x = descriptorLeft; x < descriptorRight && x < imageWidth; x++) { - int index = Numerics.Clamp(Unsafe.Add(ref indicesRowRef, x - descriptorLeft), 0, colorTableMaxIdx); - ref TPixel pixel = ref Unsafe.Add(ref rowRef, x); + int index = Numerics.Clamp(Unsafe.Add(ref indicesRowRef, (uint)(x - descriptorLeft)), 0, colorTableMaxIdx); + ref TPixel pixel = ref Unsafe.Add(ref rowRef, (uint)x); Rgb24 rgb = colorTable[index]; pixel.FromRgb24(rgb); } @@ -588,7 +588,7 @@ internal sealed class GifDecoderCore : IImageDecoderInternals { for (int x = descriptorLeft; x < descriptorRight && x < imageWidth; x++) { - int rawIndex = Unsafe.Add(ref indicesRowRef, x - descriptorLeft); + int rawIndex = Unsafe.Add(ref indicesRowRef, (uint)(x - descriptorLeft)); // Treat any out of bounds values as transparent. if (rawIndex > colorTableMaxIdx || rawIndex == transIndex) @@ -597,7 +597,7 @@ internal sealed class GifDecoderCore : IImageDecoderInternals } int index = Numerics.Clamp(rawIndex, 0, colorTableMaxIdx); - ref TPixel pixel = ref Unsafe.Add(ref rowRef, x); + ref TPixel pixel = ref Unsafe.Add(ref rowRef, (uint)x); Rgb24 rgb = colorTable[index]; pixel.FromRgb24(rgb); } diff --git a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs index 75c9b1186..f736da78d 100644 --- a/src/ImageSharp/Formats/Gif/GifEncoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifEncoderCore.cs @@ -254,7 +254,7 @@ internal sealed class GifEncoderCore : IImageEncoderInternals for (int i = rgbaSpan.Length - 1; i >= 0; i--) { - if (Unsafe.Add(ref rgbaSpanRef, i).Equals(default)) + if (Unsafe.Add(ref rgbaSpanRef, (uint)i).Equals(default)) { index = i; } diff --git a/src/ImageSharp/Formats/Gif/LzwDecoder.cs b/src/ImageSharp/Formats/Gif/LzwDecoder.cs index 64b9cf386..4d282f26c 100644 --- a/src/ImageSharp/Formats/Gif/LzwDecoder.cs +++ b/src/ImageSharp/Formats/Gif/LzwDecoder.cs @@ -115,7 +115,7 @@ internal sealed class LzwDecoder : IDisposable for (code = 0; code < clearCode; code++) { - Unsafe.Add(ref suffixRef, code) = (byte)code; + Unsafe.Add(ref suffixRef, (uint)code) = (byte)code; } Span buffer = stackalloc byte[byte.MaxValue]; @@ -182,7 +182,7 @@ internal sealed class LzwDecoder : IDisposable if (oldCode == NullCode) { - Unsafe.Add(ref pixelStackRef, top++) = Unsafe.Add(ref suffixRef, code); + Unsafe.Add(ref pixelStackRef, (uint)top++) = Unsafe.Add(ref suffixRef, (uint)code); oldCode = code; first = code; continue; @@ -191,27 +191,27 @@ internal sealed class LzwDecoder : IDisposable int inCode = code; if (code == availableCode) { - Unsafe.Add(ref pixelStackRef, top++) = (byte)first; + Unsafe.Add(ref pixelStackRef, (uint)top++) = (byte)first; code = oldCode; } while (code > clearCode) { - Unsafe.Add(ref pixelStackRef, top++) = Unsafe.Add(ref suffixRef, code); - code = Unsafe.Add(ref prefixRef, code); + Unsafe.Add(ref pixelStackRef, (uint)top++) = Unsafe.Add(ref suffixRef, (uint)code); + code = Unsafe.Add(ref prefixRef, (uint)code); } - int suffixCode = Unsafe.Add(ref suffixRef, code); + int suffixCode = Unsafe.Add(ref suffixRef, (uint)code); first = suffixCode; - Unsafe.Add(ref pixelStackRef, top++) = suffixCode; + Unsafe.Add(ref pixelStackRef, (uint)top++) = suffixCode; // Fix for Gifs that have "deferred clear code" as per here : // https://bugzilla.mozilla.org/show_bug.cgi?id=55918 if (availableCode < MaxStackSize) { - Unsafe.Add(ref prefixRef, availableCode) = oldCode; - Unsafe.Add(ref suffixRef, availableCode) = first; + Unsafe.Add(ref prefixRef, (uint)availableCode) = oldCode; + Unsafe.Add(ref suffixRef, (uint)availableCode) = first; availableCode++; if (availableCode == codeMask + 1 && availableCode < MaxStackSize) { @@ -228,7 +228,7 @@ internal sealed class LzwDecoder : IDisposable // Clear missing pixels xyz++; - Unsafe.Add(ref pixelsRowRef, x++) = (byte)Unsafe.Add(ref pixelStackRef, top); + Unsafe.Add(ref pixelsRowRef, (uint)x++) = (byte)Unsafe.Add(ref pixelStackRef, (uint)top); } } @@ -282,7 +282,7 @@ internal sealed class LzwDecoder : IDisposable for (code = 0; code < clearCode; code++) { - Unsafe.Add(ref suffixRef, code) = (byte)code; + Unsafe.Add(ref suffixRef, (uint)code) = (byte)code; } Span buffer = stackalloc byte[byte.MaxValue]; @@ -336,7 +336,7 @@ internal sealed class LzwDecoder : IDisposable if (oldCode == NullCode) { - Unsafe.Add(ref pixelStackRef, top++) = Unsafe.Add(ref suffixRef, code); + Unsafe.Add(ref pixelStackRef, (uint)top++) = Unsafe.Add(ref suffixRef, (uint)code); oldCode = code; first = code; continue; @@ -345,27 +345,27 @@ internal sealed class LzwDecoder : IDisposable int inCode = code; if (code == availableCode) { - Unsafe.Add(ref pixelStackRef, top++) = (byte)first; + Unsafe.Add(ref pixelStackRef, (uint)top++) = (byte)first; code = oldCode; } while (code > clearCode) { - Unsafe.Add(ref pixelStackRef, top++) = Unsafe.Add(ref suffixRef, code); - code = Unsafe.Add(ref prefixRef, code); + Unsafe.Add(ref pixelStackRef, (uint)top++) = Unsafe.Add(ref suffixRef, (uint)code); + code = Unsafe.Add(ref prefixRef, (uint)code); } - int suffixCode = Unsafe.Add(ref suffixRef, code); + int suffixCode = Unsafe.Add(ref suffixRef, (uint)code); first = suffixCode; - Unsafe.Add(ref pixelStackRef, top++) = suffixCode; + Unsafe.Add(ref pixelStackRef, (uint)top++) = suffixCode; // Fix for Gifs that have "deferred clear code" as per here : // https://bugzilla.mozilla.org/show_bug.cgi?id=55918 if (availableCode < MaxStackSize) { - Unsafe.Add(ref prefixRef, availableCode) = oldCode; - Unsafe.Add(ref suffixRef, availableCode) = first; + Unsafe.Add(ref prefixRef, (uint)availableCode) = oldCode; + Unsafe.Add(ref suffixRef, (uint)availableCode) = first; availableCode++; if (availableCode == codeMask + 1 && availableCode < MaxStackSize) { diff --git a/src/ImageSharp/Formats/Gif/LzwEncoder.cs b/src/ImageSharp/Formats/Gif/LzwEncoder.cs index fe27e7bf9..5253c0978 100644 --- a/src/ImageSharp/Formats/Gif/LzwEncoder.cs +++ b/src/ImageSharp/Formats/Gif/LzwEncoder.cs @@ -216,7 +216,7 @@ internal sealed class LzwEncoder : IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] private void AddCharacter(byte c, ref byte accumulatorsRef, Stream stream) { - Unsafe.Add(ref accumulatorsRef, this.accumulatorCount++) = c; + Unsafe.Add(ref accumulatorsRef, (uint)this.accumulatorCount++) = c; if (this.accumulatorCount >= 254) { this.FlushPacket(stream); @@ -278,18 +278,18 @@ internal sealed class LzwEncoder : IDisposable for (int x = offsetX; x < indexedPixels.Width; x++) { - int code = Unsafe.Add(ref rowSpanRef, x); + int code = Unsafe.Add(ref rowSpanRef, (uint)x); int freeCode = (code << MaxBits) + entry; int hashIndex = (code << HashShift) ^ entry; - if (Unsafe.Add(ref hashTableRef, hashIndex) == freeCode) + if (Unsafe.Add(ref hashTableRef, (uint)hashIndex) == freeCode) { - entry = Unsafe.Add(ref codeTableRef, hashIndex); + entry = Unsafe.Add(ref codeTableRef, (uint)hashIndex); continue; } // Non-empty slot - if (Unsafe.Add(ref hashTableRef, hashIndex) >= 0) + if (Unsafe.Add(ref hashTableRef, (uint)hashIndex) >= 0) { int disp = 1; if (hashIndex != 0) @@ -304,15 +304,15 @@ internal sealed class LzwEncoder : IDisposable hashIndex += HashSize; } - if (Unsafe.Add(ref hashTableRef, hashIndex) == freeCode) + if (Unsafe.Add(ref hashTableRef, (uint)hashIndex) == freeCode) { - entry = Unsafe.Add(ref codeTableRef, hashIndex); + entry = Unsafe.Add(ref codeTableRef, (uint)hashIndex); break; } } - while (Unsafe.Add(ref hashTableRef, hashIndex) >= 0); + while (Unsafe.Add(ref hashTableRef, (uint)hashIndex) >= 0); - if (Unsafe.Add(ref hashTableRef, hashIndex) == freeCode) + if (Unsafe.Add(ref hashTableRef, (uint)hashIndex) == freeCode) { continue; } @@ -322,8 +322,8 @@ internal sealed class LzwEncoder : IDisposable entry = code; if (this.freeEntry < MaxMaxCode) { - Unsafe.Add(ref codeTableRef, hashIndex) = this.freeEntry++; // code -> hashtable - Unsafe.Add(ref hashTableRef, hashIndex) = freeCode; + Unsafe.Add(ref codeTableRef, (uint)hashIndex) = this.freeEntry++; // code -> hashtable + Unsafe.Add(ref hashTableRef, (uint)hashIndex) = freeCode; } else { diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs index 325d6c26f..d119a18c8 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8.cs @@ -47,7 +47,7 @@ internal unsafe partial struct Block8x8 DebugGuard.MustBeBetweenOrEqualTo(idx, 0, Size - 1, nameof(idx)); ref short selfRef = ref Unsafe.As(ref this); - return Unsafe.Add(ref selfRef, idx); + return Unsafe.Add(ref selfRef, (uint)idx); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -56,7 +56,7 @@ internal unsafe partial struct Block8x8 DebugGuard.MustBeBetweenOrEqualTo(idx, 0, Size - 1, nameof(idx)); ref short selfRef = ref Unsafe.As(ref this); - Unsafe.Add(ref selfRef, idx) = value; + Unsafe.Add(ref selfRef, (uint)idx) = value; } } @@ -207,12 +207,12 @@ internal unsafe partial struct Block8x8 // Given mask is not actually suitable for lzcnt as 1's represent zero elements and 0's represent non-zero elements // So we need to invert it - int lzcnt = BitOperations.LeadingZeroCount(~(uint)areEqual); + uint lzcnt = (uint)BitOperations.LeadingZeroCount(~(uint)areEqual); // As input number is represented by 2 bits in the mask, we need to divide lzcnt result by 2 // to get the exact number of zero elements in the stride - int strideRelativeIndex = 15 - (lzcnt / 2); - return (i * 16) + strideRelativeIndex; + uint strideRelativeIndex = 15 - (lzcnt / 2); + return (i * 16) + (nint)strideRelativeIndex; } } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs index 2610befcf..d1cb3559b 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs @@ -44,31 +44,31 @@ internal partial struct Block8x8F { var off = new Vector(MathF.Ceiling(maximum / 2)); var max = new Vector(maximum); - + ref Vector row0 = ref Unsafe.As>(ref this.V0L); row0 = NormalizeAndRound(row0, off, max); - + ref Vector row1 = ref Unsafe.As>(ref this.V1L); row1 = NormalizeAndRound(row1, off, max); - + ref Vector row2 = ref Unsafe.As>(ref this.V2L); row2 = NormalizeAndRound(row2, off, max); - + ref Vector row3 = ref Unsafe.As>(ref this.V3L); row3 = NormalizeAndRound(row3, off, max); - + ref Vector row4 = ref Unsafe.As>(ref this.V4L); row4 = NormalizeAndRound(row4, off, max); - + ref Vector row5 = ref Unsafe.As>(ref this.V5L); row5 = NormalizeAndRound(row5, off, max); - + ref Vector row6 = ref Unsafe.As>(ref this.V6L); row6 = NormalizeAndRound(row6, off, max); - + ref Vector row7 = ref Unsafe.As>(ref this.V7L); row7 = NormalizeAndRound(row7, off, max); - + } /// diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Intrinsic.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Intrinsic.cs index 78c82f11a..7611d403a 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Intrinsic.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Intrinsic.cs @@ -51,7 +51,7 @@ internal partial struct Block8x8F Vector256 row = Avx2.PackSignedSaturate(row0, row1); row = Avx2.PermuteVar8x32(row.AsInt32(), multiplyIntoInt16ShuffleMask).AsInt16(); - Unsafe.Add(ref destRef, (IntPtr)((uint)i / 2)) = row; + Unsafe.Add(ref destRef, i / 2) = row; } } @@ -64,13 +64,13 @@ internal partial struct Block8x8F ref Vector128 destBase = ref Unsafe.As>(ref dest); - for (int i = 0; i < 16; i += 2) + for (nint i = 0; i < 16; i += 2) { Vector128 left = Sse2.ConvertToVector128Int32(Sse.Multiply(Unsafe.Add(ref aBase, i + 0), Unsafe.Add(ref bBase, i + 0))); Vector128 right = Sse2.ConvertToVector128Int32(Sse.Multiply(Unsafe.Add(ref aBase, i + 1), Unsafe.Add(ref bBase, i + 1))); Vector128 row = Sse2.PackSignedSaturate(left, right); - Unsafe.Add(ref destBase, (IntPtr)((uint)i / 2)) = row; + Unsafe.Add(ref destBase, i / 2) = row; } } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs index 813d9c37b..e68ede9fb 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs @@ -98,11 +98,11 @@ internal partial struct Block8x8F int xx = x * horizontalScale; float value = this[y8 + x]; - nint baseIdx = (yy * areaStride) + xx; + nint baseIdx = (nint)(uint)((yy * areaStride) + xx); for (nint i = 0; i < verticalScale; i++, baseIdx += areaStride) { - for (nint j = 0; j < horizontalScale; j++) + for (nint j = 0; j < (uint)horizontalScale; j++) { // area[xx + j, yy + i] = value; Unsafe.Add(ref areaOrigin, baseIdx + j) = value; @@ -128,8 +128,8 @@ internal partial struct Block8x8F [MethodImpl(MethodImplOptions.AggressiveInlining)] static void CopyRowImpl(ref byte origin, ref byte dest, int destStride, int row) { - origin = ref Unsafe.Add(ref origin, row * 8 * sizeof(float)); - dest = ref Unsafe.Add(ref dest, row * destStride); + origin = ref Unsafe.Add(ref origin, (uint)row * 8 * sizeof(float)); + dest = ref Unsafe.Add(ref dest, (uint)(row * destStride)); Unsafe.CopyBlock(ref dest, ref origin, 8 * sizeof(float)); } } @@ -150,8 +150,8 @@ internal partial struct Block8x8F [MethodImpl(MethodImplOptions.AggressiveInlining)] static void CopyRowImpl(ref byte origin, ref byte dest, int sourceStride, int row) { - origin = ref Unsafe.Add(ref origin, row * sourceStride); - dest = ref Unsafe.Add(ref dest, row * 8 * sizeof(float)); + origin = ref Unsafe.Add(ref origin, (uint)(row * sourceStride)); + dest = ref Unsafe.Add(ref dest, (uint)row * 8 * sizeof(float)); Unsafe.CopyBlock(ref dest, ref origin, 8 * sizeof(float)); } } diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleScalar.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleScalar.cs index 16dd7c768..df511594a 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleScalar.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleScalar.cs @@ -28,7 +28,7 @@ internal abstract partial class JpegColorConverterBase ref float valuesRef = ref MemoryMarshal.GetReference(values); float scale = 1 / maxValue; - for (nint i = 0; i < values.Length; i++) + for (nint i = 0; i < (uint)values.Length; i++) { Unsafe.Add(ref valuesRef, i) *= scale; } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs index 922d7093b..59789dcd2 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs @@ -705,7 +705,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder // Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients. // Table F.4: Point to statistics bin S0 for DC coefficient coding. - ref byte st = ref Unsafe.Add(ref component.DcStatistics.GetReference(), component.DcContext); + ref byte st = ref Unsafe.Add(ref component.DcStatistics.GetReference(), (uint)component.DcContext); // Figure F.19: Decode_DC_DIFF if (this.DecodeBinaryDecision(ref reader, ref st) == 0) @@ -955,7 +955,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder // Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients. // Table F.4: Point to statistics bin S0 for DC coefficient coding. - ref byte st = ref Unsafe.Add(ref component.DcStatistics.GetReference(), component.DcContext); + ref byte st = ref Unsafe.Add(ref component.DcStatistics.GetReference(), (uint)component.DcContext); /* Figure F.19: Decode_DC_DIFF */ if (this.DecodeBinaryDecision(ref reader, ref st) == 0) diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs index e5c5098d0..bbd2bff53 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/HuffmanScanDecoder.cs @@ -211,7 +211,7 @@ internal class HuffmanScanDecoder : IJpegScanDecoder this.DecodeBlockBaseline( component, - ref Unsafe.Add(ref blockRef, blockCol), + ref Unsafe.Add(ref blockRef, (uint)blockCol), ref dcHuffmanTable, ref acHuffmanTable); } @@ -255,7 +255,7 @@ internal class HuffmanScanDecoder : IJpegScanDecoder this.DecodeBlockBaseline( component, - ref Unsafe.Add(ref blockRef, i), + ref Unsafe.Add(ref blockRef, (uint)i), ref dcHuffmanTable, ref acHuffmanTable); @@ -297,7 +297,7 @@ internal class HuffmanScanDecoder : IJpegScanDecoder this.DecodeBlockBaseline( component, - ref Unsafe.Add(ref blockRef, k), + ref Unsafe.Add(ref blockRef, (uint)k), ref dcHuffmanTable, ref acHuffmanTable); @@ -417,7 +417,7 @@ internal class HuffmanScanDecoder : IJpegScanDecoder this.DecodeBlockProgressiveDC( component, - ref Unsafe.Add(ref blockRef, blockCol), + ref Unsafe.Add(ref blockRef, (uint)blockCol), ref dcHuffmanTable); } } @@ -459,7 +459,7 @@ internal class HuffmanScanDecoder : IJpegScanDecoder this.DecodeBlockProgressiveDC( component, - ref Unsafe.Add(ref blockRef, i), + ref Unsafe.Add(ref blockRef, (uint)i), ref dcHuffmanTable); this.HandleRestart(); @@ -485,7 +485,7 @@ internal class HuffmanScanDecoder : IJpegScanDecoder } this.DecodeBlockProgressiveAC( - ref Unsafe.Add(ref blockRef, i), + ref Unsafe.Add(ref blockRef, (uint)i), ref acHuffmanTable); this.HandleRestart(); diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs index 23ddd0e49..3c89ab1fb 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs @@ -141,7 +141,7 @@ internal class ComponentProcessor : IDisposable ref float targetRef = ref MemoryMarshal.GetReference(target); ref float sourceRef = ref MemoryMarshal.GetReference(source); - for (nint i = count * Vector.Count; i < source.Length; i++) + for (nint i = count * Vector.Count; i < (uint)source.Length; i++) { Unsafe.Add(ref targetRef, i) += Unsafe.Add(ref sourceRef, i); } @@ -166,16 +166,16 @@ internal class ComponentProcessor : IDisposable source = source.Slice(touchedCount); target = target.Slice(touchedCount / factor); - uint length = (uint)touchedCount / (uint)Vector256.Count; + nint length = (nint)(uint)touchedCount / Vector256.Count; for (int i = 0; i < haddIterationsCount; i++) { length /= 2; - for (nuint j = 0; j < length; j++) + for (nint j = 0; j < length; j++) { - nuint indexLeft = j * 2; - nuint indexRight = indexLeft + 1; + nint indexLeft = j * 2; + nint indexRight = indexLeft + 1; Vector256 sum = Avx.HorizontalAdd(Unsafe.Add(ref targetRef, indexLeft), Unsafe.Add(ref targetRef, indexRight)); Unsafe.Add(ref targetRef, j) = Avx2.Permute4x64(sum.AsDouble(), 0b11_01_10_00).AsSingle(); } @@ -219,7 +219,7 @@ internal class ComponentProcessor : IDisposable } ref float targetRef = ref MemoryMarshal.GetReference(target); - for (nint i = count * Vector.Count; i < target.Length; i++) + for (nint i = count * Vector.Count; i < (uint)target.Length; i++) { Unsafe.Add(ref targetRef, i) *= multiplier; } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs index 8edbc3c40..f479df7e2 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/HuffmanScanEncoder.cs @@ -180,7 +180,7 @@ internal class HuffmanScanEncoder Span blockSpan = component.SpectralBlocks.DangerousGetRowSpan(y: 0); ref Block8x8 blockRef = ref MemoryMarshal.GetReference(blockSpan); - for (nint k = 0; k < w; k++) + for (nint k = 0; k < (uint)w; k++) { this.WriteBlock( component, @@ -219,7 +219,7 @@ internal class HuffmanScanEncoder Span blockSpan = component.SpectralBlocks.DangerousGetRowSpan(y: i); ref Block8x8 blockRef = ref MemoryMarshal.GetReference(blockSpan); - for (nint k = 0; k < w; k++) + for (nint k = 0; k < (uint)w; k++) { this.WriteBlock( component, diff --git a/src/ImageSharp/Formats/Png/Filters/AverageFilter.cs b/src/ImageSharp/Formats/Png/Filters/AverageFilter.cs index 34e05d779..0e601f526 100644 --- a/src/ImageSharp/Formats/Png/Filters/AverageFilter.cs +++ b/src/ImageSharp/Formats/Png/Filters/AverageFilter.cs @@ -42,7 +42,7 @@ internal static class AverageFilter } else { - DecodeScalar(scanline, previousScanline, bytesPerPixel); + DecodeScalar(scanline, previousScanline, (nint)(uint)bytesPerPixel); } } @@ -88,7 +88,7 @@ internal static class AverageFilter Vector64 d = Vector64.Zero; int rb = scanline.Length; - int offset = 1; + nint offset = 1; const int bytesPerBatch = 4; while (rb >= bytesPerBatch) { @@ -108,7 +108,7 @@ internal static class AverageFilter } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void DecodeScalar(Span scanline, Span previousScanline, int bytesPerPixel) + private static void DecodeScalar(Span scanline, Span previousScanline, nint bytesPerPixel) { ref byte scanBaseRef = ref MemoryMarshal.GetReference(scanline); ref byte prevBaseRef = ref MemoryMarshal.GetReference(previousScanline); @@ -121,7 +121,7 @@ internal static class AverageFilter scan = (byte)(scan + (above >> 1)); } - for (; x < scanline.Length; ++x) + for (; x < (uint)scanline.Length; ++x) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, x); byte left = Unsafe.Add(ref scanBaseRef, x - bytesPerPixel); @@ -153,7 +153,7 @@ internal static class AverageFilter resultBaseRef = (byte)FilterType.Average; nint x = 0; - for (; x < bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) + for (; x < (uint)bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte above = Unsafe.Add(ref prevBaseRef, x); @@ -169,7 +169,7 @@ internal static class AverageFilter Vector256 sumAccumulator = Vector256.Zero; Vector256 allBitsSet = Avx2.CompareEqual(sumAccumulator, sumAccumulator).AsByte(); - for (nint xLeft = x - bytesPerPixel; x <= scanline.Length - Vector256.Count; xLeft += Vector256.Count) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x <= (uint)scanline.Length - Vector256.Count; xLeft += Vector256.Count) { Vector256 scan = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, x)); Vector256 left = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, xLeft)); @@ -192,7 +192,7 @@ internal static class AverageFilter Vector128 sumAccumulator = Vector128.Zero; Vector128 allBitsSet = Sse2.CompareEqual(sumAccumulator, sumAccumulator).AsByte(); - for (nint xLeft = x - bytesPerPixel; x <= scanline.Length - Vector128.Count; xLeft += Vector128.Count) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x <= (uint)scanline.Length - Vector128.Count; xLeft += Vector128.Count) { Vector128 scan = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, x)); Vector128 left = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, xLeft)); @@ -221,7 +221,7 @@ internal static class AverageFilter sum += Numerics.EvenReduceSum(sumAccumulator); } - for (nint xLeft = x - bytesPerPixel; x < scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x < (uint)scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte left = Unsafe.Add(ref scanBaseRef, xLeft); diff --git a/src/ImageSharp/Formats/Png/Filters/PaethFilter.cs b/src/ImageSharp/Formats/Png/Filters/PaethFilter.cs index 8998d6bc0..540ec6323 100644 --- a/src/ImageSharp/Formats/Png/Filters/PaethFilter.cs +++ b/src/ImageSharp/Formats/Png/Filters/PaethFilter.cs @@ -187,14 +187,14 @@ internal static class PaethFilter // Paeth(x) + PaethPredictor(Raw(x-bpp), Prior(x), Prior(x-bpp)) int offset = bytesPerPixel + 1; // Add one because x starts at one. nint x = 1; - for (; x < offset; x++) + for (; x < (uint)offset; x++) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, x); byte above = Unsafe.Add(ref prevBaseRef, x); scan = (byte)(scan + above); } - for (; x < scanline.Length; x++) + for (; x < (uint)scanline.Length; x++) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, x); byte left = Unsafe.Add(ref scanBaseRef, x - bytesPerPixel); @@ -227,7 +227,7 @@ internal static class PaethFilter resultBaseRef = (byte)FilterType.Paeth; nint x = 0; - for (; x < bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) + for (; x < (uint)bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte above = Unsafe.Add(ref prevBaseRef, x); @@ -242,7 +242,7 @@ internal static class PaethFilter Vector256 zero = Vector256.Zero; Vector256 sumAccumulator = Vector256.Zero; - for (nint xLeft = x - bytesPerPixel; x <= scanline.Length - Vector256.Count; xLeft += Vector256.Count) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x <= (nint)(uint)scanline.Length - Vector256.Count; xLeft += Vector256.Count) { Vector256 scan = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, x)); Vector256 left = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, xLeft)); @@ -262,7 +262,7 @@ internal static class PaethFilter { Vector sumAccumulator = Vector.Zero; - for (nint xLeft = x - bytesPerPixel; x <= scanline.Length - Vector.Count; xLeft += Vector.Count) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x <= (nint)(uint)scanline.Length - Vector.Count; xLeft += Vector.Count) { Vector scan = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, x)); Vector left = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, xLeft)); @@ -282,7 +282,7 @@ internal static class PaethFilter } } - for (nint xLeft = x - bytesPerPixel; x < scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x < (nint)(uint)scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte left = Unsafe.Add(ref scanBaseRef, xLeft); diff --git a/src/ImageSharp/Formats/Png/Filters/SubFilter.cs b/src/ImageSharp/Formats/Png/Filters/SubFilter.cs index 0f4aa3fcf..5dc7b15d7 100644 --- a/src/ImageSharp/Formats/Png/Filters/SubFilter.cs +++ b/src/ImageSharp/Formats/Png/Filters/SubFilter.cs @@ -36,7 +36,7 @@ internal static class SubFilter } else { - DecodeScalar(scanline, bytesPerPixel); + DecodeScalar(scanline, (nint)(uint)bytesPerPixel); } } @@ -70,7 +70,7 @@ internal static class SubFilter Vector64 d = Vector64.Zero; int rb = scanline.Length; - int offset = 1; + nint offset = 1; const int bytesPerBatch = 4; while (rb >= bytesPerBatch) { @@ -87,7 +87,7 @@ internal static class SubFilter } } - private static void DecodeScalar(Span scanline, int bytesPerPixel) + private static void DecodeScalar(Span scanline, nint bytesPerPixel) { ref byte scanBaseRef = ref MemoryMarshal.GetReference(scanline); @@ -122,7 +122,7 @@ internal static class SubFilter resultBaseRef = (byte)FilterType.Sub; nint x = 0; - for (; x < bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) + for (; x < (nint)(uint)bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); ++x; @@ -136,7 +136,7 @@ internal static class SubFilter Vector256 zero = Vector256.Zero; Vector256 sumAccumulator = Vector256.Zero; - for (nint xLeft = x - bytesPerPixel; x <= scanline.Length - Vector256.Count; xLeft += Vector256.Count) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x <= (nint)(uint)scanline.Length - Vector256.Count; xLeft += Vector256.Count) { Vector256 scan = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, x)); Vector256 prev = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, xLeft)); @@ -154,7 +154,7 @@ internal static class SubFilter { Vector sumAccumulator = Vector.Zero; - for (nint xLeft = x - bytesPerPixel; x <= scanline.Length - Vector.Count; xLeft += Vector.Count) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x <= (nint)(uint)scanline.Length - Vector.Count; xLeft += Vector.Count) { Vector scan = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, x)); Vector prev = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, xLeft)); @@ -172,7 +172,7 @@ internal static class SubFilter } } - for (nint xLeft = x - bytesPerPixel; x < scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x < (nint)(uint)scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte prev = Unsafe.Add(ref scanBaseRef, xLeft); diff --git a/src/ImageSharp/Formats/Png/Filters/UpFilter.cs b/src/ImageSharp/Formats/Png/Filters/UpFilter.cs index f90b129b6..55cc9ad6e 100644 --- a/src/ImageSharp/Formats/Png/Filters/UpFilter.cs +++ b/src/ImageSharp/Formats/Png/Filters/UpFilter.cs @@ -66,7 +66,7 @@ internal static class UpFilter } // Handle left over. - for (nint i = offset; i < scanline.Length; i++) + for (nint i = offset; i < (uint)scanline.Length; i++) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, offset); byte above = Unsafe.Add(ref prevBaseRef, offset); @@ -96,7 +96,7 @@ internal static class UpFilter } // Handle left over. - for (nint i = offset; i < scanline.Length; i++) + for (nint i = offset; i < (uint)scanline.Length; i++) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, offset); byte above = Unsafe.Add(ref prevBaseRef, offset); @@ -127,7 +127,7 @@ internal static class UpFilter } // Handle left over. - for (nint i = offset; i < scanline.Length; i++) + for (nint i = offset; i < (uint)scanline.Length; i++) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, offset); byte above = Unsafe.Add(ref prevBaseRef, offset); @@ -143,7 +143,7 @@ internal static class UpFilter ref byte prevBaseRef = ref MemoryMarshal.GetReference(previousScanline); // Up(x) + Prior(x) - for (nint x = 1; x < scanline.Length; x++) + for (nint x = 1; x < (uint)scanline.Length; x++) { ref byte scan = ref Unsafe.Add(ref scanBaseRef, x); byte above = Unsafe.Add(ref prevBaseRef, x); @@ -179,7 +179,7 @@ internal static class UpFilter Vector256 zero = Vector256.Zero; Vector256 sumAccumulator = Vector256.Zero; - for (; x <= scanline.Length - Vector256.Count;) + for (; x <= (nint)(uint)(scanline.Length - Vector256.Count);) { Vector256 scan = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, x)); Vector256 above = Unsafe.As>(ref Unsafe.Add(ref prevBaseRef, x)); @@ -197,7 +197,7 @@ internal static class UpFilter { Vector sumAccumulator = Vector.Zero; - for (; x <= scanline.Length - Vector.Count;) + for (; x <= (nint)(uint)(scanline.Length - Vector.Count);) { Vector scan = Unsafe.As>(ref Unsafe.Add(ref scanBaseRef, x)); Vector above = Unsafe.As>(ref Unsafe.Add(ref prevBaseRef, x)); @@ -215,7 +215,7 @@ internal static class UpFilter } } - for (; x < scanline.Length; /* Note: ++x happens in the body to avoid one add operation */) + for (; x < (nint)(uint)scanline.Length; /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte above = Unsafe.Add(ref prevBaseRef, x); diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index 5c7423211..ea8120a5c 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -414,11 +414,11 @@ internal sealed class PngDecoderCore : IImageDecoderInternals for (int i = 0; i < bytesPerScanline; i++) { - byte b = Unsafe.Add(ref sourceRef, i); + byte b = Unsafe.Add(ref sourceRef, (uint)i); for (int shift = 0; shift < 8; shift += bits) { int colorIndex = (b >> (8 - bits - shift)) & mask; - Unsafe.Add(ref resultRef, resultOffset) = (byte)colorIndex; + Unsafe.Add(ref resultRef, (uint)resultOffset) = (byte)colorIndex; resultOffset++; } } diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index 5a66fc7d4..4657ab17b 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -266,7 +266,7 @@ internal sealed class PngEncoderCore : IImageEncoderInternals, IDisposable // Can't map directly to byte array as it's big-endian. for (int x = 0, o = 0; x < luminanceSpan.Length; x++, o += 2) { - L16 luminance = Unsafe.Add(ref luminanceRef, x); + L16 luminance = Unsafe.Add(ref luminanceRef, (uint)x); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o, 2), luminance.PackedValue); } } @@ -306,7 +306,7 @@ internal sealed class PngEncoderCore : IImageEncoderInternals, IDisposable // Can't map directly to byte array as it's big endian. for (int x = 0, o = 0; x < laSpan.Length; x++, o += 4) { - La32 la = Unsafe.Add(ref laRef, x); + La32 la = Unsafe.Add(ref laRef, (uint)x); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o, 2), la.L); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o + 2, 2), la.A); } @@ -366,7 +366,7 @@ internal sealed class PngEncoderCore : IImageEncoderInternals, IDisposable // Can't map directly to byte array as it's big endian. for (int x = 0, o = 0; x < rowSpan.Length; x++, o += 8) { - Rgba64 rgba = Unsafe.Add(ref rgbaRef, x); + Rgba64 rgba = Unsafe.Add(ref rgbaRef, (uint)x); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o, 2), rgba.R); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o + 2, 2), rgba.G); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o + 4, 2), rgba.B); @@ -388,7 +388,7 @@ internal sealed class PngEncoderCore : IImageEncoderInternals, IDisposable // Can't map directly to byte array as it's big endian. for (int x = 0, o = 0; x < rowSpan.Length; x++, o += 6) { - Rgb48 rgb = Unsafe.Add(ref rgbRef, x); + Rgb48 rgb = Unsafe.Add(ref rgbRef, (uint)x); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o, 2), rgb.R); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o + 2, 2), rgb.G); BinaryPrimitives.WriteUInt16BigEndian(rawScanlineSpan.Slice(o + 4, 2), rgb.B); @@ -617,17 +617,17 @@ internal sealed class PngEncoderCore : IImageEncoderInternals, IDisposable // Loop, assign, and extract alpha values from the palette. for (int i = 0; i < paletteLength; i++) { - Rgba32 rgba = Unsafe.Add(ref rgbaPaletteRef, i); + Rgba32 rgba = Unsafe.Add(ref rgbaPaletteRef, (uint)i); byte alpha = rgba.A; - Unsafe.Add(ref colorTableRef, i) = rgba.Rgb; + Unsafe.Add(ref colorTableRef, (uint)i) = rgba.Rgb; if (alpha > this.encoder.Threshold) { alpha = byte.MaxValue; } hasAlpha = hasAlpha || alpha < byte.MaxValue; - Unsafe.Add(ref alphaTableRef, i) = alpha; + Unsafe.Add(ref alphaTableRef, (uint)i) = alpha; } this.WriteChunk(stream, PngChunkType.Palette, colorTable.GetSpan(), 0, colorTableLength); diff --git a/src/ImageSharp/Formats/Png/PngEncoderHelpers.cs b/src/ImageSharp/Formats/Png/PngEncoderHelpers.cs index 5bee1ebd5..712bd0e06 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderHelpers.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderHelpers.cs @@ -31,13 +31,13 @@ internal static class PngEncoderHelpers for (int i = 0; i < source.Length; i++) { - int value = ((int)MathF.Round(Unsafe.Add(ref sourceRef, i) / scale)) & mask; + int value = ((int)MathF.Round(Unsafe.Add(ref sourceRef, (uint)i) / scale)) & mask; v |= value << shift; if (shift == 0) { shift = shift0; - Unsafe.Add(ref resultRef, resultOffset) = (byte)v; + Unsafe.Add(ref resultRef, (uint)resultOffset) = (byte)v; resultOffset++; v = 0; } @@ -49,7 +49,7 @@ internal static class PngEncoderHelpers if (shift != shift0) { - Unsafe.Add(ref resultRef, resultOffset) = (byte)v; + Unsafe.Add(ref resultRef, (uint)resultOffset) = (byte)v; } } } diff --git a/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs b/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs index cf77788bc..25c4a0d70 100644 --- a/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs +++ b/src/ImageSharp/Formats/Png/PngScanlineProcessor.cs @@ -36,16 +36,16 @@ internal static class PngScanlineProcessor { ushort luminance = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2)); pixel.FromL16(Unsafe.As(ref luminance)); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else { for (int x = 0; x < header.Width; x++) { - byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, x) * scaleFactor); + byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, (uint)x) * scaleFactor); pixel.FromL8(Unsafe.As(ref luminance)); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } @@ -62,7 +62,7 @@ internal static class PngScanlineProcessor source.A = luminance.Equals(luminance16Trans.PackedValue) ? ushort.MinValue : ushort.MaxValue; pixel.FromLa32(source); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -71,12 +71,12 @@ internal static class PngScanlineProcessor byte scaledLuminanceTrans = (byte)(luminanceTrans.PackedValue * scaleFactor); for (int x = 0; x < header.Width; x++) { - byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, x) * scaleFactor); + byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, (uint)x) * scaleFactor); source.L = luminance; source.A = luminance.Equals(scaledLuminanceTrans) ? byte.MinValue : byte.MaxValue; pixel.FromLa16(source); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } } @@ -105,16 +105,16 @@ internal static class PngScanlineProcessor { ushort luminance = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o, 2)); pixel.FromL16(Unsafe.As(ref luminance)); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else { for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o++) { - byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, o) * scaleFactor); + byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, (uint)o) * scaleFactor); pixel.FromL8(Unsafe.As(ref luminance)); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } @@ -131,7 +131,7 @@ internal static class PngScanlineProcessor source.A = luminance.Equals(luminance16Trans.PackedValue) ? ushort.MinValue : ushort.MaxValue; pixel.FromLa32(source); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -140,12 +140,12 @@ internal static class PngScanlineProcessor byte scaledLuminanceTrans = (byte)(luminanceTrans.PackedValue * scaleFactor); for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o++) { - byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, o) * scaleFactor); + byte luminance = (byte)(Unsafe.Add(ref scanlineSpanRef, (uint)o) * scaleFactor); source.L = luminance; source.A = luminance.Equals(scaledLuminanceTrans) ? byte.MinValue : byte.MaxValue; pixel.FromLa16(source); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } } @@ -171,7 +171,7 @@ internal static class PngScanlineProcessor source.A = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + 2, 2)); pixel.FromLa32(source); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -180,11 +180,11 @@ internal static class PngScanlineProcessor for (int x = 0; x < header.Width; x++) { int offset = x * bytesPerPixel; - source.L = Unsafe.Add(ref scanlineSpanRef, offset); - source.A = Unsafe.Add(ref scanlineSpanRef, offset + bytesPerSample); + source.L = Unsafe.Add(ref scanlineSpanRef, (uint)offset); + source.A = Unsafe.Add(ref scanlineSpanRef, (uint)(offset + bytesPerSample)); pixel.FromLa16(source); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } } @@ -212,7 +212,7 @@ internal static class PngScanlineProcessor source.A = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + 2, 2)); pixel.FromLa32(source); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -221,11 +221,11 @@ internal static class PngScanlineProcessor La16 source = default; for (int x = pixelOffset; x < header.Width; x += increment) { - source.L = Unsafe.Add(ref scanlineSpanRef, offset); - source.A = Unsafe.Add(ref scanlineSpanRef, offset + bytesPerSample); + source.L = Unsafe.Add(ref scanlineSpanRef, (uint)offset); + source.A = Unsafe.Add(ref scanlineSpanRef, (uint)(offset + bytesPerSample)); pixel.FromLa16(source); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; offset += bytesPerPixel; } } @@ -259,23 +259,23 @@ internal static class PngScanlineProcessor for (int x = 0; x < header.Width; x++) { - int index = Unsafe.Add(ref scanlineSpanRef, x); - rgba.Rgb = Unsafe.Add(ref palettePixelsRef, index); - rgba.A = paletteAlpha.Length > index ? Unsafe.Add(ref paletteAlphaRef, index) : byte.MaxValue; + int index = Unsafe.Add(ref scanlineSpanRef, (uint)x); + rgba.Rgb = Unsafe.Add(ref palettePixelsRef, (uint)index); + rgba.A = paletteAlpha.Length > index ? Unsafe.Add(ref paletteAlphaRef, (uint)index) : byte.MaxValue; pixel.FromRgba32(rgba); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else { for (int x = 0; x < header.Width; x++) { - int index = Unsafe.Add(ref scanlineSpanRef, x); - Rgb24 rgb = Unsafe.Add(ref palettePixelsRef, index); + int index = Unsafe.Add(ref scanlineSpanRef, (uint)x); + Rgb24 rgb = Unsafe.Add(ref palettePixelsRef, (uint)index); pixel.FromRgb24(rgb); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } } @@ -304,23 +304,23 @@ internal static class PngScanlineProcessor ref byte paletteAlphaRef = ref paletteAlpha[0]; for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o++) { - int index = Unsafe.Add(ref scanlineSpanRef, o); - rgba.A = paletteAlpha.Length > index ? Unsafe.Add(ref paletteAlphaRef, index) : byte.MaxValue; - rgba.Rgb = Unsafe.Add(ref palettePixelsRef, index); + int index = Unsafe.Add(ref scanlineSpanRef, (uint)o); + rgba.A = paletteAlpha.Length > index ? Unsafe.Add(ref paletteAlphaRef, (uint)index) : byte.MaxValue; + rgba.Rgb = Unsafe.Add(ref palettePixelsRef, (uint)index); pixel.FromRgba32(rgba); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else { for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o++) { - int index = Unsafe.Add(ref scanlineSpanRef, o); - Rgb24 rgb = Unsafe.Add(ref palettePixelsRef, index); + int index = Unsafe.Add(ref scanlineSpanRef, (uint)o); + Rgb24 rgb = Unsafe.Add(ref palettePixelsRef, (uint)index); pixel.FromRgb24(rgb); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } } @@ -352,7 +352,7 @@ internal static class PngScanlineProcessor rgb48.B = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (2 * bytesPerSample), bytesPerSample)); pixel.FromRgb48(rgb48); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -377,7 +377,7 @@ internal static class PngScanlineProcessor rgba64.A = rgb48.Equals(rgb48Trans) ? ushort.MinValue : ushort.MaxValue; pixel.FromRgba64(rgba64); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -387,12 +387,12 @@ internal static class PngScanlineProcessor ref Rgb24 rgb24SpanRef = ref MemoryMarshal.GetReference(rgb24Span); for (int x = 0; x < header.Width; x++) { - ref readonly Rgb24 rgb24 = ref Unsafe.Add(ref rgb24SpanRef, x); + ref readonly Rgb24 rgb24 = ref Unsafe.Add(ref rgb24SpanRef, (uint)x); rgba32.Rgb = rgb24; rgba32.A = rgb24.Equals(rgb24Trans) ? byte.MinValue : byte.MaxValue; pixel.FromRgba32(rgba32); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } } @@ -430,7 +430,7 @@ internal static class PngScanlineProcessor rgba64.A = rgb48.Equals(rgb48Trans) ? ushort.MinValue : ushort.MaxValue; pixel.FromRgba64(rgba64); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -443,7 +443,7 @@ internal static class PngScanlineProcessor rgb48.B = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (2 * bytesPerSample), bytesPerSample)); pixel.FromRgb48(rgb48); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } @@ -455,13 +455,13 @@ internal static class PngScanlineProcessor Rgba32 rgba = default; for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o += bytesPerPixel) { - rgba.R = Unsafe.Add(ref scanlineSpanRef, o); - rgba.G = Unsafe.Add(ref scanlineSpanRef, o + bytesPerSample); - rgba.B = Unsafe.Add(ref scanlineSpanRef, o + (2 * bytesPerSample)); + rgba.R = Unsafe.Add(ref scanlineSpanRef, (uint)o); + rgba.G = Unsafe.Add(ref scanlineSpanRef, (uint)(o + bytesPerSample)); + rgba.B = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (2 * bytesPerSample))); rgba.A = rgb24Trans.Equals(rgba.Rgb) ? byte.MinValue : byte.MaxValue; pixel.FromRgba32(rgba); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -469,12 +469,12 @@ internal static class PngScanlineProcessor Rgb24 rgb = default; for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o += bytesPerPixel) { - rgb.R = Unsafe.Add(ref scanlineSpanRef, o); - rgb.G = Unsafe.Add(ref scanlineSpanRef, o + bytesPerSample); - rgb.B = Unsafe.Add(ref scanlineSpanRef, o + (2 * bytesPerSample)); + rgb.R = Unsafe.Add(ref scanlineSpanRef, (uint)o); + rgb.G = Unsafe.Add(ref scanlineSpanRef, (uint)(o + bytesPerSample)); + rgb.B = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (2 * bytesPerSample))); pixel.FromRgb24(rgb); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } } @@ -502,7 +502,7 @@ internal static class PngScanlineProcessor rgba64.A = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (3 * bytesPerSample), bytesPerSample)); pixel.FromRgba64(rgba64); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -536,7 +536,7 @@ internal static class PngScanlineProcessor rgba64.A = BinaryPrimitives.ReadUInt16BigEndian(scanlineSpan.Slice(o + (3 * bytesPerSample), bytesPerSample)); pixel.FromRgba64(rgba64); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } else @@ -544,13 +544,13 @@ internal static class PngScanlineProcessor Rgba32 rgba = default; for (int x = pixelOffset, o = 0; x < header.Width; x += increment, o += bytesPerPixel) { - rgba.R = Unsafe.Add(ref scanlineSpanRef, o); - rgba.G = Unsafe.Add(ref scanlineSpanRef, o + bytesPerSample); - rgba.B = Unsafe.Add(ref scanlineSpanRef, o + (2 * bytesPerSample)); - rgba.A = Unsafe.Add(ref scanlineSpanRef, o + (3 * bytesPerSample)); + rgba.R = Unsafe.Add(ref scanlineSpanRef, (uint)o); + rgba.G = Unsafe.Add(ref scanlineSpanRef, (uint)(o + bytesPerSample)); + rgba.B = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (2 * bytesPerSample))); + rgba.A = Unsafe.Add(ref scanlineSpanRef, (uint)(o + (3 * bytesPerSample))); pixel.FromRgba32(rgba); - Unsafe.Add(ref rowSpanRef, x) = pixel; + Unsafe.Add(ref rowSpanRef, (uint)x) = pixel; } } } diff --git a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs index eb97272cb..1cd8e0dc8 100644 --- a/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs +++ b/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6TiffCompression.cs @@ -78,7 +78,7 @@ internal sealed class T6TiffCompression : TiffBaseDecompressor nint bitPos = Numerics.Modulo8(bitsWritten); nint bufferPos = bitsWritten / 8; ref byte scanLineRef = ref MemoryMarshal.GetReference(scanLine); - for (nint i = 0; i < scanLine.Length; i++) + for (nint i = 0; i < (uint)scanLine.Length; i++) { if (Unsafe.Add(ref scanLineRef, i) != this.white) { diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor{TPixel}.cs index 6187ab8fa..a5a04d19d 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor{TPixel}.cs @@ -29,7 +29,7 @@ internal class BlackIsZero1TiffColor : TiffBaseColorDecoder { Span pixelRowSpan = pixels.DangerousGetRowSpan((int)y); ref TPixel pixelRowRef = ref MemoryMarshal.GetReference(pixelRowSpan); - for (nint x = left; x < left + width; x += 8) + for (nint x = (nint)(uint)left; x < (nint)(uint)(left + width); x += 8) { byte b = Unsafe.Add(ref dataRef, offset++); nint maxShift = Math.Min(left + width - x, 8); @@ -70,9 +70,9 @@ internal class BlackIsZero1TiffColor : TiffBaseColorDecoder } else { - for (int shift = 0; shift < maxShift; shift++) + for (nint shift = 0; shift < maxShift; shift++) { - int bit = (b >> (7 - shift)) & 1; + int bit = (b >> (7 - (int)shift)) & 1; ref TPixel pixel = ref Unsafe.Add(ref pixelRowRef, x + shift); pixel = bit == 0 ? colorBlack : colorWhite; diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor{TPixel}.cs index a7519bc14..737f95767 100644 --- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor{TPixel}.cs +++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor{TPixel}.cs @@ -24,11 +24,11 @@ internal class WhiteIsZero1TiffColor : TiffBaseColorDecoder colorBlack.FromRgba32(Color.Black); colorWhite.FromRgba32(Color.White); ref byte dataRef = ref MemoryMarshal.GetReference(data); - for (nint y = top; y < top + height; y++) + for (nint y = top; y < (nint)(uint)(top + height); y++) { Span pixelRowSpan = pixels.DangerousGetRowSpan((int)y); ref TPixel pixelRowRef = ref MemoryMarshal.GetReference(pixelRowSpan); - for (nint x = left; x < left + width; x += 8) + for (nint x = left; x < (nint)(uint)(left + width); x += 8) { byte b = Unsafe.Add(ref dataRef, offset++); nint maxShift = Math.Min(left + width - x, 8); @@ -73,7 +73,7 @@ internal class WhiteIsZero1TiffColor : TiffBaseColorDecoder { int bit = (b >> (7 - shift)) & 1; - ref TPixel pixel = ref Unsafe.Add(ref pixelRowRef, x + shift); + ref TPixel pixel = ref Unsafe.Add(ref pixelRowRef, x + (nint)(uint)shift); pixel = bit == 0 ? colorWhite : colorBlack; } } diff --git a/src/ImageSharp/Formats/Webp/AlphaDecoder.cs b/src/ImageSharp/Formats/Webp/AlphaDecoder.cs index 8875ae115..637a38d1e 100644 --- a/src/ImageSharp/Formats/Webp/AlphaDecoder.cs +++ b/src/ImageSharp/Formats/Webp/AlphaDecoder.cs @@ -322,7 +322,8 @@ internal class AlphaDecoder : IDisposable nint i; Vector128 last = Vector128.Zero.WithElement(0, dst[0]); ref byte srcRef = ref MemoryMarshal.GetReference(input); - for (i = 1; i + 8 <= width; i += 8) + ref byte dstRef = ref MemoryMarshal.GetReference(dst); + for (i = 1; i <= (uint)width - 8; i += 8) { Vector128 a0 = Vector128.Create(Unsafe.As(ref Unsafe.Add(ref srcRef, i)), 0); Vector128 a1 = Sse2.Add(a0.AsByte(), last.AsByte()); @@ -333,12 +334,12 @@ internal class AlphaDecoder : IDisposable Vector128 a6 = Sse2.ShiftLeftLogical128BitLane(a5, 4); Vector128 a7 = Sse2.Add(a5, a6); - ref byte outputRef = ref Unsafe.Add(ref MemoryMarshal.GetReference(dst), i); + ref byte outputRef = ref Unsafe.Add(ref dstRef, i); Unsafe.As>(ref outputRef) = a7.GetLower(); last = Sse2.ShiftRightLogical(a7.AsInt64(), 56).AsInt32(); } - for (; i < width; ++i) + for (; i < (uint)width; ++i) { dst[(int)i] = (byte)(input[(int)i] + dst[(int)i - 1]); } @@ -366,7 +367,7 @@ internal class AlphaDecoder : IDisposable { nint i; int maxPos = width & ~31; - for (i = 0; i < maxPos; i += 32) + for (i = 0; i < (uint)maxPos; i += 32) { Vector256 a0 = Unsafe.As>(ref Unsafe.Add(ref MemoryMarshal.GetReference(input), i)); Vector256 b0 = Unsafe.As>(ref Unsafe.Add(ref MemoryMarshal.GetReference(prev), i)); @@ -375,7 +376,7 @@ internal class AlphaDecoder : IDisposable Unsafe.As>(ref outputRef) = c0; } - for (; i < width; i++) + for (; i < (uint) width; i++) { dst[(int)i] = (byte)(prev[(int)i] + input[(int)i]); } diff --git a/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs b/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs index ac92ce6a6..d4db3db53 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/LosslessUtils.cs @@ -51,7 +51,7 @@ internal static unsafe class LosslessUtils ref uint array1Ref = ref MemoryMarshal.GetReference(array1); ref uint array2Ref = ref MemoryMarshal.GetReference(array2); - while (matchLen < length && Unsafe.Add(ref array1Ref, matchLen) == Unsafe.Add(ref array2Ref, matchLen)) + while (matchLen < length && Unsafe.Add(ref array1Ref, (uint)matchLen) == Unsafe.Add(ref array2Ref, (uint)matchLen)) { matchLen++; } @@ -99,7 +99,7 @@ internal static unsafe class LosslessUtils Vector256 addGreenToBlueAndRedMaskAvx2 = Vector256.Create(1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255, 17, 255, 17, 255, 21, 255, 21, 255, 25, 255, 25, 255, 29, 255, 29, 255); int numPixels = pixelData.Length; nint i; - for (i = 0; i <= numPixels - 8; i += 8) + for (i = 0; i <= (nint)(uint)numPixels - 8; i += 8) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), i); Vector256 input = Unsafe.As>(ref pos).AsByte(); @@ -118,7 +118,7 @@ internal static unsafe class LosslessUtils Vector128 addGreenToBlueAndRedMaskSsse3 = Vector128.Create(1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255); int numPixels = pixelData.Length; nint i; - for (i = 0; i <= numPixels - 4; i += 4) + for (i = 0; i <= (nint)(uint)numPixels - 4; i += 4) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), i); Vector128 input = Unsafe.As>(ref pos).AsByte(); @@ -136,7 +136,7 @@ internal static unsafe class LosslessUtils { int numPixels = pixelData.Length; nint i; - for (i = 0; i <= numPixels - 4; i += 4) + for (i = 0; i <= (nint)(uint)numPixels - 4; i += 4) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), i); Vector128 input = Unsafe.As>(ref pos).AsByte(); @@ -179,7 +179,7 @@ internal static unsafe class LosslessUtils Vector256 subtractGreenFromBlueAndRedMaskAvx2 = Vector256.Create(1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255, 17, 255, 17, 255, 21, 255, 21, 255, 25, 255, 25, 255, 29, 255, 29, 255); int numPixels = pixelData.Length; nint i; - for (i = 0; i <= numPixels - 8; i += 8) + for (i = 0; i <= (nint)(uint)numPixels - 8; i += 8) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), i); Vector256 input = Unsafe.As>(ref pos).AsByte(); @@ -198,7 +198,7 @@ internal static unsafe class LosslessUtils Vector128 subtractGreenFromBlueAndRedMaskSsse3 = Vector128.Create(1, 255, 1, 255, 5, 255, 5, 255, 9, 255, 9, 255, 13, 255, 13, 255); int numPixels = pixelData.Length; nint i; - for (i = 0; i <= numPixels - 4; i += 4) + for (i = 0; i <= (nint)(uint)numPixels - 4; i += 4) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), i); Vector128 input = Unsafe.As>(ref pos).AsByte(); @@ -216,7 +216,7 @@ internal static unsafe class LosslessUtils { int numPixels = pixelData.Length; nint i; - for (i = 0; i <= numPixels - 4; i += 4) + for (i = 0; i <= (nint)(uint)numPixels - 4; i += 4) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), i); Vector128 input = Unsafe.As>(ref pos).AsByte(); @@ -373,7 +373,7 @@ internal static unsafe class LosslessUtils Vector256 multsb2 = MkCst32(Cst5b(m.RedToBlue), 0); nint idx; - for (idx = 0; idx <= numPixels - 8; idx += 8) + for (idx = 0; idx <= (nint)(uint)numPixels - 8; idx += 8) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), idx); Vector256 input = Unsafe.As>(ref pos); @@ -402,7 +402,7 @@ internal static unsafe class LosslessUtils Vector128 multsrb = MkCst16(Cst5b(m.GreenToRed), Cst5b(m.GreenToBlue)); Vector128 multsb2 = MkCst16(Cst5b(m.RedToBlue), 0); nint idx; - for (idx = 0; idx <= numPixels - 4; idx += 4) + for (idx = 0; idx <= (nint)(uint)numPixels - 4; idx += 4) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), idx); Vector128 input = Unsafe.As>(ref pos); @@ -461,7 +461,7 @@ internal static unsafe class LosslessUtils Vector256 multsrb = MkCst32(Cst5b(m.GreenToRed), Cst5b(m.GreenToBlue)); Vector256 multsb2 = MkCst32(Cst5b(m.RedToBlue), 0); nint idx; - for (idx = 0; idx <= pixelData.Length - 8; idx += 8) + for (idx = 0; idx <= (nint)(uint)pixelData.Length - 8; idx += 8) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), idx); Vector256 input = Unsafe.As>(ref pos); @@ -491,7 +491,7 @@ internal static unsafe class LosslessUtils Vector128 multsb2 = MkCst16(Cst5b(m.RedToBlue), 0); nint idx; - for (idx = 0; idx <= pixelData.Length - 4; idx += 4) + for (idx = 0; idx <= (nint)(uint)pixelData.Length - 4; idx += 4) { ref uint pos = ref Unsafe.Add(ref MemoryMarshal.GetReference(pixelData), idx); Vector128 input = Unsafe.As>(ref pos); diff --git a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs index a4bb2168d..3f44a1bc0 100644 --- a/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs +++ b/src/ImageSharp/Formats/Webp/Lossless/Vp8LHistogram.cs @@ -518,28 +518,29 @@ internal sealed class Vp8LHistogram : IDeepCloneable ref uint aRef = ref MemoryMarshal.GetReference(a); ref uint bRef = ref MemoryMarshal.GetReference(b); ref uint outputRef = ref MemoryMarshal.GetReference(output); - int i; + nint idx; - for (i = 0; i + 32 <= count; i += 32) + for (idx = 0; idx <= (nint)(uint)count - 32; idx += 32) { // Load values. - Vector256 a0 = Unsafe.As>(ref Unsafe.Add(ref aRef, i)); - Vector256 a1 = Unsafe.As>(ref Unsafe.Add(ref aRef, i + 8)); - Vector256 a2 = Unsafe.As>(ref Unsafe.Add(ref aRef, i + 16)); - Vector256 a3 = Unsafe.As>(ref Unsafe.Add(ref aRef, i + 24)); - Vector256 b0 = Unsafe.As>(ref Unsafe.Add(ref bRef, i)); - Vector256 b1 = Unsafe.As>(ref Unsafe.Add(ref bRef, i + 8)); - Vector256 b2 = Unsafe.As>(ref Unsafe.Add(ref bRef, i + 16)); - Vector256 b3 = Unsafe.As>(ref Unsafe.Add(ref bRef, i + 24)); + Vector256 a0 = Unsafe.As>(ref Unsafe.Add(ref aRef, idx)); + Vector256 a1 = Unsafe.As>(ref Unsafe.Add(ref aRef, idx + 8)); + Vector256 a2 = Unsafe.As>(ref Unsafe.Add(ref aRef, idx + 16)); + Vector256 a3 = Unsafe.As>(ref Unsafe.Add(ref aRef, idx + 24)); + Vector256 b0 = Unsafe.As>(ref Unsafe.Add(ref bRef, idx)); + Vector256 b1 = Unsafe.As>(ref Unsafe.Add(ref bRef, idx + 8)); + Vector256 b2 = Unsafe.As>(ref Unsafe.Add(ref bRef, idx + 16)); + Vector256 b3 = Unsafe.As>(ref Unsafe.Add(ref bRef, idx + 24)); // Note we are adding uint32_t's as *signed* int32's (using _mm_add_epi32). But // that's ok since the histogram values are less than 1<<28 (max picture count). - Unsafe.As>(ref Unsafe.Add(ref outputRef, i)) = Avx2.Add(a0, b0); - Unsafe.As>(ref Unsafe.Add(ref outputRef, i + 8)) = Avx2.Add(a1, b1); - Unsafe.As>(ref Unsafe.Add(ref outputRef, i + 16)) = Avx2.Add(a2, b2); - Unsafe.As>(ref Unsafe.Add(ref outputRef, i + 24)) = Avx2.Add(a3, b3); + Unsafe.As>(ref Unsafe.Add(ref outputRef, idx)) = Avx2.Add(a0, b0); + Unsafe.As>(ref Unsafe.Add(ref outputRef, idx + 8)) = Avx2.Add(a1, b1); + Unsafe.As>(ref Unsafe.Add(ref outputRef, idx + 16)) = Avx2.Add(a2, b2); + Unsafe.As>(ref Unsafe.Add(ref outputRef, idx + 24)) = Avx2.Add(a3, b3); } + int i = (int)idx; for (; i < count; i++) { output[i] = a[i] + b[i]; diff --git a/src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs b/src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs index 316c705e3..565e4c029 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs @@ -1427,17 +1427,17 @@ internal static class LossyUtils if (Sse2.IsSupported) { // Load. - ref byte pRef = ref Unsafe.Add(ref MemoryMarshal.GetReference(p), offset); + ref byte pRef = ref Unsafe.Add(ref MemoryMarshal.GetReference(p), (uint)offset); Vector128 p1 = Unsafe.As>(ref Unsafe.Subtract(ref pRef, 2 * stride)); Vector128 p0 = Unsafe.As>(ref Unsafe.Subtract(ref pRef, stride)); Vector128 q0 = Unsafe.As>(ref pRef); - Vector128 q1 = Unsafe.As>(ref Unsafe.Add(ref pRef, stride)); + Vector128 q1 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)stride)); DoFilter2Sse2(ref p1, ref p0, ref q0, ref q1, thresh); // Store. - ref byte outputRef = ref Unsafe.Add(ref MemoryMarshal.GetReference(p), offset); + ref byte outputRef = ref Unsafe.Add(ref MemoryMarshal.GetReference(p), (uint)offset); Unsafe.As>(ref Unsafe.Subtract(ref outputRef, stride)) = p0.AsSByte(); Unsafe.As>(ref outputRef) = q0.AsSByte(); } @@ -1460,11 +1460,11 @@ internal static class LossyUtils if (Sse2.IsSupported) { // Beginning of p1 - ref byte pRef = ref Unsafe.Add(ref MemoryMarshal.GetReference(p), offset - 2); + ref byte pRef = ref Unsafe.Add(ref MemoryMarshal.GetReference(p), (uint)(offset - 2)); - Load16x4(ref pRef, ref Unsafe.Add(ref pRef, 8 * stride), stride, out Vector128 p1, out Vector128 p0, out Vector128 q0, out Vector128 q1); + Load16x4(ref pRef, ref Unsafe.Add(ref pRef, 8 * (uint)stride), stride, out Vector128 p1, out Vector128 p0, out Vector128 q0, out Vector128 q1); DoFilter2Sse2(ref p1, ref p0, ref q0, ref q1, thresh); - Store16x4(p1, p0, q0, q1, ref pRef, ref Unsafe.Add(ref pRef, 8 * stride), stride); + Store16x4(p1, p0, q0, q1, ref pRef, ref Unsafe.Add(ref pRef, 8 * (uint)stride), stride); } else { @@ -1527,19 +1527,19 @@ internal static class LossyUtils if (Sse2.IsSupported) { ref byte pRef = ref MemoryMarshal.GetReference(p); - Vector128 t1 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset - (4 * stride))); - Vector128 p2 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset - (3 * stride))); - Vector128 p1 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset - (2 * stride))); - Vector128 p0 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset - stride)); + Vector128 t1 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset - (4 * stride)))); + Vector128 p2 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset - (3 * stride)))); + Vector128 p1 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset - (2 * stride)))); + Vector128 p0 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset - stride))); Vector128 mask = Abs(p1, p0); mask = Sse2.Max(mask, Abs(t1, p2)); mask = Sse2.Max(mask, Abs(p2, p1)); - Vector128 q0 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset)); - Vector128 q1 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + stride)); - Vector128 q2 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + (2 * stride))); - t1 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + (3 * stride))); + Vector128 q0 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)offset)); + Vector128 q1 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + stride))); + Vector128 q2 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + (2 * stride)))); + t1 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + (3 * stride)))); mask = Sse2.Max(mask, Abs(q1, q0)); mask = Sse2.Max(mask, Abs(t1, q2)); @@ -1550,12 +1550,12 @@ internal static class LossyUtils // Store. ref byte outputRef = ref MemoryMarshal.GetReference(p); - Unsafe.As>(ref Unsafe.Add(ref outputRef, offset - (3 * stride))) = p2.AsInt32(); - Unsafe.As>(ref Unsafe.Add(ref outputRef, offset - (2 * stride))) = p1.AsInt32(); - Unsafe.As>(ref Unsafe.Add(ref outputRef, offset - stride)) = p0.AsInt32(); - Unsafe.As>(ref Unsafe.Add(ref outputRef, offset)) = q0.AsInt32(); - Unsafe.As>(ref Unsafe.Add(ref outputRef, offset + stride)) = q1.AsInt32(); - Unsafe.As>(ref Unsafe.Add(ref outputRef, offset + (2 * stride))) = q2.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)(offset - (3 * stride)))) = p2.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)(offset - (2 * stride)))) = p1.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)(offset - stride))) = p0.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)(offset))) = q0.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)(offset + stride))) = q1.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)(offset + (2 * stride)))) = q2.AsInt32(); } else { @@ -1569,14 +1569,14 @@ internal static class LossyUtils if (Sse2.IsSupported) { ref byte pRef = ref MemoryMarshal.GetReference(p); - ref byte bRef = ref Unsafe.Add(ref pRef, offset - 4); - Load16x4(ref bRef, ref Unsafe.Add(ref bRef, 8 * stride), stride, out Vector128 p3, out Vector128 p2, out Vector128 p1, out Vector128 p0); + ref byte bRef = ref Unsafe.Add(ref pRef, (uint)offset - 4); + Load16x4(ref bRef, ref Unsafe.Add(ref bRef, 8 * (uint)stride), stride, out Vector128 p3, out Vector128 p2, out Vector128 p1, out Vector128 p0); Vector128 mask = Abs(p1, p0); mask = Sse2.Max(mask, Abs(p3, p2)); mask = Sse2.Max(mask, Abs(p2, p1)); - Load16x4(ref Unsafe.Add(ref pRef, offset), ref Unsafe.Add(ref pRef, offset + (8 * stride)), stride, out Vector128 q0, out Vector128 q1, out Vector128 q2, out Vector128 q3); + Load16x4(ref Unsafe.Add(ref pRef, (uint)offset), ref Unsafe.Add(ref pRef, (uint)(offset + (8 * stride))), stride, out Vector128 q0, out Vector128 q1, out Vector128 q2, out Vector128 q3); mask = Sse2.Max(mask, Abs(q1, q0)); mask = Sse2.Max(mask, Abs(q3, q2)); @@ -1585,8 +1585,8 @@ internal static class LossyUtils ComplexMask(p1, p0, q0, q1, thresh, ithresh, ref mask); DoFilter6Sse2(ref p2, ref p1, ref p0, ref q0, ref q1, ref q2, mask, hevThresh); - Store16x4(p3, p2, p1, p0, ref bRef, ref Unsafe.Add(ref bRef, 8 * stride), stride); - Store16x4(q0, q1, q2, q3, ref Unsafe.Add(ref pRef, offset), ref Unsafe.Add(ref pRef, offset + (8 * stride)), stride); + Store16x4(p3, p2, p1, p0, ref bRef, ref Unsafe.Add(ref bRef, 8 * (uint)stride), stride); + Store16x4(q0, q1, q2, q3, ref Unsafe.Add(ref pRef, (uint)offset), ref Unsafe.Add(ref pRef, (uint)(offset + (8 * stride))), stride); } else { @@ -1599,10 +1599,10 @@ internal static class LossyUtils if (Sse2.IsSupported) { ref byte pRef = ref MemoryMarshal.GetReference(p); - Vector128 p3 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset)); - Vector128 p2 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + stride)); - Vector128 p1 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + (2 * stride))); - Vector128 p0 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + (3 * stride))); + Vector128 p3 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset))); + Vector128 p2 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + stride))); + Vector128 p1 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + (2 * stride)))); + Vector128 p0 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + (3 * stride)))); for (int k = 3; k > 0; k--) { @@ -1614,10 +1614,10 @@ internal static class LossyUtils mask = Sse2.Max(mask, Abs(p3, p2)); mask = Sse2.Max(mask, Abs(p2, p1)); - p3 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset)); - p2 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + stride)); - Vector128 tmp1 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + (2 * stride))); - Vector128 tmp2 = Unsafe.As>(ref Unsafe.Add(ref pRef, offset + (3 * stride))); + p3 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)offset)); + p2 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + stride))); + Vector128 tmp1 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + (2 * stride)))); + Vector128 tmp2 = Unsafe.As>(ref Unsafe.Add(ref pRef, (uint)(offset + (3 * stride)))); mask = Sse2.Max(mask, Abs(tmp1, tmp2)); mask = Sse2.Max(mask, Abs(p3, p2)); @@ -1631,9 +1631,9 @@ internal static class LossyUtils // Store. ref byte outputRef = ref MemoryMarshal.GetReference(b); Unsafe.As>(ref outputRef) = p1.AsInt32(); - Unsafe.As>(ref Unsafe.Add(ref outputRef, stride)) = p0.AsInt32(); - Unsafe.As>(ref Unsafe.Add(ref outputRef, stride * 2)) = p3.AsInt32(); - Unsafe.As>(ref Unsafe.Add(ref outputRef, stride * 3)) = p2.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)stride)) = p0.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)(stride * 2))) = p3.AsInt32(); + Unsafe.As>(ref Unsafe.Add(ref outputRef, (uint)(stride * 3))) = p2.AsInt32(); // Rotate samples. p1 = tmp1; @@ -1655,13 +1655,13 @@ internal static class LossyUtils if (Sse2.IsSupported) { ref byte pRef = ref MemoryMarshal.GetReference(p); - Load16x4(ref Unsafe.Add(ref pRef, offset), ref Unsafe.Add(ref pRef, offset + (8 * stride)), stride, out Vector128 p3, out Vector128 p2, out Vector128 p1, out Vector128 p0); + Load16x4(ref Unsafe.Add(ref pRef, (uint)offset), ref Unsafe.Add(ref pRef, (uint)(offset + (8 * stride))), stride, out Vector128 p3, out Vector128 p2, out Vector128 p1, out Vector128 p0); Vector128 mask; for (int k = 3; k > 0; k--) { // Beginning of p1. - ref byte bRef = ref Unsafe.Add(ref pRef, offset + 2); + ref byte bRef = ref Unsafe.Add(ref pRef, (uint)offset + 2); // Beginning of q0 (and next span). offset += 4; @@ -1671,7 +1671,7 @@ internal static class LossyUtils mask = Sse2.Max(mask, Abs(p3, p2)); mask = Sse2.Max(mask, Abs(p2, p1)); - Load16x4(ref Unsafe.Add(ref pRef, offset), ref Unsafe.Add(ref pRef, offset + (8 * stride)), stride, out p3, out p2, out Vector128 tmp1, out Vector128 tmp2); + Load16x4(ref Unsafe.Add(ref pRef, (uint)offset), ref Unsafe.Add(ref pRef, (uint)(offset + (8 * stride))), stride, out p3, out p2, out Vector128 tmp1, out Vector128 tmp2); mask = Sse2.Max(mask, Abs(tmp1, tmp2)); mask = Sse2.Max(mask, Abs(p3, p2)); @@ -1680,7 +1680,7 @@ internal static class LossyUtils ComplexMask(p1, p0, p3, p2, thresh, ithresh, ref mask); DoFilter4Sse2(ref p1, ref p0, ref p3, ref p2, mask, hevThresh); - Store16x4(p1, p0, p3, p2, ref bRef, ref Unsafe.Add(ref bRef, 8 * stride), stride); + Store16x4(p1, p0, p3, p2, ref bRef, ref Unsafe.Add(ref bRef, 8 * (uint)stride), stride); // Rotate samples. p1 = tmp1; @@ -1749,13 +1749,13 @@ internal static class LossyUtils { ref byte uRef = ref MemoryMarshal.GetReference(u); ref byte vRef = ref MemoryMarshal.GetReference(v); - Load16x4(ref Unsafe.Add(ref uRef, offset - 4), ref Unsafe.Add(ref vRef, offset - 4), stride, out Vector128 p3, out Vector128 p2, out Vector128 p1, out Vector128 p0); + Load16x4(ref Unsafe.Add(ref uRef, (uint)offset - 4), ref Unsafe.Add(ref vRef, (uint)offset - 4), stride, out Vector128 p3, out Vector128 p2, out Vector128 p1, out Vector128 p0); Vector128 mask = Abs(p1, p0); mask = Sse2.Max(mask, Abs(p3, p2)); mask = Sse2.Max(mask, Abs(p2, p1)); - Load16x4(ref Unsafe.Add(ref uRef, offset), ref Unsafe.Add(ref vRef, offset), stride, out Vector128 q0, out Vector128 q1, out Vector128 q2, out Vector128 q3); + Load16x4(ref Unsafe.Add(ref uRef, (uint)offset), ref Unsafe.Add(ref vRef, (uint)offset), stride, out Vector128 q0, out Vector128 q1, out Vector128 q2, out Vector128 q3); mask = Sse2.Max(mask, Abs(q1, q0)); mask = Sse2.Max(mask, Abs(q3, q2)); @@ -1764,8 +1764,8 @@ internal static class LossyUtils ComplexMask(p1, p0, q0, q1, thresh, ithresh, ref mask); DoFilter6Sse2(ref p2, ref p1, ref p0, ref q0, ref q1, ref q2, mask, hevThresh); - Store16x4(p3, p2, p1, p0, ref Unsafe.Add(ref uRef, offset - 4), ref Unsafe.Add(ref vRef, offset - 4), stride); - Store16x4(q0, q1, q2, q3, ref Unsafe.Add(ref uRef, offset), ref Unsafe.Add(ref vRef, offset), stride); + Store16x4(p3, p2, p1, p0, ref Unsafe.Add(ref uRef, (uint)offset - 4), ref Unsafe.Add(ref vRef, (uint)offset - 4), stride); + Store16x4(q0, q1, q2, q3, ref Unsafe.Add(ref uRef, (uint)offset), ref Unsafe.Add(ref vRef, (uint)offset), stride); } else { @@ -1826,7 +1826,7 @@ internal static class LossyUtils { ref byte uRef = ref MemoryMarshal.GetReference(u); ref byte vRef = ref MemoryMarshal.GetReference(v); - Load16x4(ref Unsafe.Add(ref uRef, offset), ref Unsafe.Add(ref vRef, offset), stride, out Vector128 t2, out Vector128 t1, out Vector128 p1, out Vector128 p0); + Load16x4(ref Unsafe.Add(ref uRef, (uint)offset), ref Unsafe.Add(ref vRef, (uint)offset), stride, out Vector128 t2, out Vector128 t1, out Vector128 p1, out Vector128 p0); Vector128 mask = Abs(p1, p0); mask = Sse2.Max(mask, Abs(t2, t1)); @@ -1835,7 +1835,7 @@ internal static class LossyUtils // Beginning of q0. offset += 4; - Load16x4(ref Unsafe.Add(ref uRef, offset), ref Unsafe.Add(ref vRef, offset), stride, out Vector128 q0, out Vector128 q1, out t1, out t2); + Load16x4(ref Unsafe.Add(ref uRef, (uint)offset), ref Unsafe.Add(ref vRef, (uint)offset), stride, out Vector128 q0, out Vector128 q1, out t1, out t2); mask = Sse2.Max(mask, Abs(q1, q0)); mask = Sse2.Max(mask, Abs(t2, t1)); @@ -1846,7 +1846,7 @@ internal static class LossyUtils // Beginning of p1. offset -= 2; - Store16x4(p1, p0, q0, q1, ref Unsafe.Add(ref uRef, offset), ref Unsafe.Add(ref vRef, offset), stride); + Store16x4(p1, p0, q0, q1, ref Unsafe.Add(ref uRef, (uint)offset), ref Unsafe.Add(ref vRef, (uint)offset), stride); } else { @@ -2278,8 +2278,8 @@ internal static class LossyUtils // q0 = 73 63 53 43 33 23 13 03 72 62 52 42 32 22 12 02 // p0 = f1 e1 d1 c1 b1 a1 91 81 f0 e0 d0 c0 b0 a0 90 80 // q1 = f3 e3 d3 c3 b3 a3 93 83 f2 e2 d2 c2 b2 a2 92 82 - Load8x4(ref r0, stride, out Vector128 t1, out Vector128 t2); - Load8x4(ref r8, stride, out p0, out q1); + Load8x4(ref r0, (nint)(uint)stride, out Vector128 t1, out Vector128 t2); + Load8x4(ref r8, (nint)(uint)stride, out p0, out q1); // p1 = f0 e0 d0 c0 b0 a0 90 80 70 60 50 40 30 20 10 00 // p0 = f1 e1 d1 c1 b1 a1 91 81 71 61 51 41 31 21 11 01 @@ -2292,7 +2292,7 @@ internal static class LossyUtils } // Reads 8 rows across a vertical edge. - private static void Load8x4(ref byte bRef, int stride, out Vector128 p, out Vector128 q) + private static void Load8x4(ref byte bRef, nint stride, out Vector128 p, out Vector128 q) { // A0 = 63 62 61 60 23 22 21 20 43 42 41 40 03 02 01 00 // A1 = 73 72 71 70 33 32 31 30 53 52 51 50 13 12 11 10 @@ -2349,10 +2349,10 @@ internal static class LossyUtils q1s = Sse2.UnpackHigh(t1.AsInt16(), q1s.AsInt16()).AsByte(); Store4x4(p0s, ref r0Ref, stride); - Store4x4(q0s, ref Unsafe.Add(ref r0Ref, 4 * stride), stride); + Store4x4(q0s, ref Unsafe.Add(ref r0Ref, 4 * (uint)stride), stride); Store4x4(p1s, ref r8Ref, stride); - Store4x4(q1s, ref Unsafe.Add(ref r8Ref, 4 * stride), stride); + Store4x4(q1s, ref Unsafe.Add(ref r8Ref, 4 * (uint)stride), stride); } private static void Store4x4(Vector128 x, ref byte dstRef, int stride) @@ -2360,7 +2360,7 @@ internal static class LossyUtils int offset = 0; for (int i = 0; i < 4; i++) { - Unsafe.As(ref Unsafe.Add(ref dstRef, offset)) = Sse2.ConvertToInt32(x.AsInt32()); + Unsafe.As(ref Unsafe.Add(ref dstRef, (uint)offset)) = Sse2.ConvertToInt32(x.AsInt32()); x = Sse2.ShiftRightLogical128BitLane(x, 4); offset += stride; } @@ -2421,16 +2421,16 @@ internal static class LossyUtils [MethodImpl(InliningOptions.ShortMethod)] private static Vector128 LoadUvEdge(ref byte uRef, ref byte vRef, int offset) { - var uVec = Vector128.Create(Unsafe.As(ref Unsafe.Add(ref uRef, offset)), 0); - var vVec = Vector128.Create(Unsafe.As(ref Unsafe.Add(ref vRef, offset)), 0); + var uVec = Vector128.Create(Unsafe.As(ref Unsafe.Add(ref uRef, (uint)offset)), 0); + var vVec = Vector128.Create(Unsafe.As(ref Unsafe.Add(ref vRef, (uint)offset)), 0); return Sse2.UnpackLow(uVec, vVec).AsByte(); } [MethodImpl(InliningOptions.ShortMethod)] private static void StoreUv(Vector128 x, ref byte uRef, ref byte vRef, int offset) { - Unsafe.As>(ref Unsafe.Add(ref uRef, offset)) = x.GetLower(); - Unsafe.As>(ref Unsafe.Add(ref vRef, offset)) = x.GetUpper(); + Unsafe.As>(ref Unsafe.Add(ref uRef, (uint)offset)) = x.GetLower(); + Unsafe.As>(ref Unsafe.Add(ref vRef, (uint)offset)) = x.GetUpper(); } // Compute abs(p - q) = subs(p - q) OR subs(q - p) diff --git a/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs b/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs index fca0d03f2..75b92a1aa 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs @@ -789,7 +789,7 @@ internal static unsafe class QuantEnc { int score = 0; ref short levelsRef = ref MemoryMarshal.GetReference(levels); - int offset = 0; + nint offset = 0; while (numBlocks-- > 0) { for (nint i = 1; i < 16; i++) diff --git a/src/ImageSharp/Formats/Webp/Lossy/YuvConversion.cs b/src/ImageSharp/Formats/Webp/Lossy/YuvConversion.cs index 5c6dde622..8ef7fe9cb 100644 --- a/src/ImageSharp/Formats/Webp/Lossy/YuvConversion.cs +++ b/src/ImageSharp/Formats/Webp/Lossy/YuvConversion.cs @@ -138,8 +138,8 @@ internal static class YuvConversion { for (pos = 1, uvPos = 0; pos + 32 + 1 <= len; pos += 32, uvPos += 16) { - UpSample32Pixels(ref Unsafe.Add(ref topURef, uvPos), ref Unsafe.Add(ref curURef, uvPos), ru); - UpSample32Pixels(ref Unsafe.Add(ref topVRef, uvPos), ref Unsafe.Add(ref curVRef, uvPos), rv); + UpSample32Pixels(ref Unsafe.Add(ref topURef, (uint)uvPos), ref Unsafe.Add(ref curURef, (uint)uvPos), ru); + UpSample32Pixels(ref Unsafe.Add(ref topVRef, (uint)uvPos), ref Unsafe.Add(ref curVRef, (uint)uvPos), rv); ConvertYuvToBgrWithBottomYSse41(topY, bottomY, topDst, bottomDst, ru, rv, pos, xStep); } } @@ -147,8 +147,8 @@ internal static class YuvConversion { for (pos = 1, uvPos = 0; pos + 32 + 1 <= len; pos += 32, uvPos += 16) { - UpSample32Pixels(ref Unsafe.Add(ref topURef, uvPos), ref Unsafe.Add(ref curURef, uvPos), ru); - UpSample32Pixels(ref Unsafe.Add(ref topVRef, uvPos), ref Unsafe.Add(ref curVRef, uvPos), rv); + UpSample32Pixels(ref Unsafe.Add(ref topURef, (uint)uvPos), ref Unsafe.Add(ref curURef, (uint)uvPos), ru); + UpSample32Pixels(ref Unsafe.Add(ref topVRef, (uint)uvPos), ref Unsafe.Add(ref curVRef, (uint)uvPos), rv); ConvertYuvToBgrSse41(topY, topDst, ru, rv, pos, xStep); } } diff --git a/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs b/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs index a18bd3447..a6ed797d6 100644 --- a/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs +++ b/src/ImageSharp/Memory/Allocators/Internals/ManagedBufferBase.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors. +// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.Buffers; diff --git a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs index d63fd2076..9695c7f98 100644 --- a/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs +++ b/src/ImageSharp/Memory/DiscontiguousBuffers/MemoryGroup{T}.cs @@ -252,7 +252,7 @@ internal abstract partial class MemoryGroup : IMemoryGroup, IDisposable { ref byte b0 = ref MemoryMarshal.GetReference(this.memoryGroupSpanCache.SingleArray); ref T e0 = ref Unsafe.As(ref b0); - e0 = ref Unsafe.Add(ref e0, y * width); + e0 = ref Unsafe.Add(ref e0, (uint)(y * width)); return MemoryMarshal.CreateSpan(ref e0, width); } diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs index 2db61a06f..079230676 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.cs @@ -52,7 +52,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -89,7 +89,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -157,7 +157,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -194,7 +194,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -262,7 +262,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -299,7 +299,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -367,7 +367,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -404,7 +404,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -472,7 +472,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -509,7 +509,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -577,7 +577,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -614,7 +614,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -682,7 +682,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -719,7 +719,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -787,7 +787,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -824,7 +824,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -892,7 +892,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -929,7 +929,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -997,7 +997,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1034,7 +1034,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1102,7 +1102,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1139,7 +1139,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1207,7 +1207,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1244,7 +1244,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1312,7 +1312,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1349,7 +1349,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1417,7 +1417,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1454,7 +1454,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1522,7 +1522,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1559,7 +1559,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1627,7 +1627,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1664,7 +1664,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1732,7 +1732,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1769,7 +1769,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1837,7 +1837,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1874,7 +1874,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1942,7 +1942,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -1979,7 +1979,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2047,7 +2047,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2084,7 +2084,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2152,7 +2152,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2189,7 +2189,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2257,7 +2257,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2294,7 +2294,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2362,7 +2362,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2399,7 +2399,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2467,7 +2467,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2504,7 +2504,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2572,7 +2572,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2609,7 +2609,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2677,7 +2677,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2714,7 +2714,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2782,7 +2782,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2819,7 +2819,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2887,7 +2887,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2924,7 +2924,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -2992,7 +2992,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3029,7 +3029,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3097,7 +3097,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3134,7 +3134,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3202,7 +3202,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3239,7 +3239,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3307,7 +3307,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3344,7 +3344,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3412,7 +3412,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3449,7 +3449,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3517,7 +3517,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3554,7 +3554,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3622,7 +3622,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3659,7 +3659,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3727,7 +3727,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3764,7 +3764,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3832,7 +3832,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3869,7 +3869,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3937,7 +3937,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -3974,7 +3974,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4042,7 +4042,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4079,7 +4079,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4147,7 +4147,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4184,7 +4184,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4252,7 +4252,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4289,7 +4289,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4357,7 +4357,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4394,7 +4394,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4462,7 +4462,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4499,7 +4499,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4567,7 +4567,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4604,7 +4604,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4672,7 +4672,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4709,7 +4709,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4777,7 +4777,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4814,7 +4814,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4882,7 +4882,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4919,7 +4919,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -4987,7 +4987,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5024,7 +5024,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5092,7 +5092,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5129,7 +5129,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5197,7 +5197,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5234,7 +5234,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5302,7 +5302,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5339,7 +5339,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5407,7 +5407,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5444,7 +5444,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5512,7 +5512,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5549,7 +5549,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5617,7 +5617,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5654,7 +5654,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5722,7 +5722,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5759,7 +5759,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5827,7 +5827,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5864,7 +5864,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5932,7 +5932,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -5969,7 +5969,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6037,7 +6037,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6074,7 +6074,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6142,7 +6142,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6179,7 +6179,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6247,7 +6247,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6284,7 +6284,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6352,7 +6352,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6389,7 +6389,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6457,7 +6457,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6494,7 +6494,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6562,7 +6562,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6599,7 +6599,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6667,7 +6667,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6704,7 +6704,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6772,7 +6772,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6809,7 +6809,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6877,7 +6877,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6914,7 +6914,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -6982,7 +6982,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7019,7 +7019,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7087,7 +7087,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7124,7 +7124,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7192,7 +7192,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7229,7 +7229,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7297,7 +7297,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7334,7 +7334,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7402,7 +7402,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7439,7 +7439,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7507,7 +7507,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7544,7 +7544,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7612,7 +7612,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7649,7 +7649,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7717,7 +7717,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7754,7 +7754,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7822,7 +7822,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7859,7 +7859,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7927,7 +7927,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -7964,7 +7964,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8032,7 +8032,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8069,7 +8069,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8137,7 +8137,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8174,7 +8174,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8242,7 +8242,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8279,7 +8279,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8347,7 +8347,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8384,7 +8384,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8452,7 +8452,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8489,7 +8489,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8557,7 +8557,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8594,7 +8594,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8662,7 +8662,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8699,7 +8699,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8767,7 +8767,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8804,7 +8804,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8872,7 +8872,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8909,7 +8909,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -8977,7 +8977,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9014,7 +9014,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9082,7 +9082,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9119,7 +9119,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9187,7 +9187,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9224,7 +9224,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9292,7 +9292,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9329,7 +9329,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9397,7 +9397,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9434,7 +9434,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9502,7 +9502,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9539,7 +9539,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9607,7 +9607,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9644,7 +9644,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9712,7 +9712,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9749,7 +9749,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9817,7 +9817,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9854,7 +9854,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9922,7 +9922,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -9959,7 +9959,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10027,7 +10027,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10064,7 +10064,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10132,7 +10132,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10169,7 +10169,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10237,7 +10237,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10274,7 +10274,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10342,7 +10342,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10379,7 +10379,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10447,7 +10447,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10484,7 +10484,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10552,7 +10552,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10589,7 +10589,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10657,7 +10657,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10694,7 +10694,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10762,7 +10762,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10799,7 +10799,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10867,7 +10867,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10904,7 +10904,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -10972,7 +10972,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -11009,7 +11009,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -11077,7 +11077,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -11114,7 +11114,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -11182,7 +11182,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -11219,7 +11219,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -11287,7 +11287,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -11324,7 +11324,7 @@ internal static class DefaultPixelBlenders { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); diff --git a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt index 22b9ebf98..da6208eaa 100644 --- a/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelBlenders/DefaultPixelBlenders.Generated.tt @@ -95,7 +95,7 @@ var blenders = new []{ { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); @@ -132,7 +132,7 @@ var blenders = new []{ { // Divide by 2 as 4 elements per Vector4 and 8 per Vector256 ref Vector256 destinationBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination)); - ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (IntPtr)((uint)destination.Length / 2u)); + ref Vector256 destinationLast = ref Unsafe.Add(ref destinationBase, (uint)destination.Length / 2u); ref Vector256 backgroundBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(background)); ref Vector256 sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source)); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs index ca68c5aaf..4891abba8 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Abgr32.cs @@ -216,7 +216,7 @@ public partial struct Abgr32 : IPixel, IPackedVector { // We can assign the Bgr24 value directly to last three bytes of this instance. ref byte thisRef = ref Unsafe.As(ref this); - ref byte thisRefFromB = ref Unsafe.AddByteOffset(ref thisRef, new IntPtr(1)); + ref byte thisRefFromB = ref Unsafe.AddByteOffset(ref thisRef, 1); Unsafe.As(ref thisRefFromB) = source; this.A = byte.MaxValue; } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs index 65b36059b..aedf4ad19 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/Bgr24.cs @@ -190,7 +190,7 @@ public partial struct Bgr24 : IPixel { // We can assign this instances value directly to last three bytes of the Abgr32. ref byte sourceRef = ref Unsafe.As(ref source); - ref byte sourceRefFromB = ref Unsafe.AddByteOffset(ref sourceRef, new IntPtr(1)); + ref byte sourceRefFromB = ref Unsafe.AddByteOffset(ref sourceRef, 1); this = Unsafe.As(ref sourceRefFromB); } diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Abgr32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Abgr32.PixelOperations.Generated.cs index cb67f7ffb..9fca0cdc3 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Abgr32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Abgr32.PixelOperations.Generated.cs @@ -210,7 +210,7 @@ public partial struct Abgr32 ref Abgr32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Abgr32 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); @@ -231,7 +231,7 @@ public partial struct Abgr32 ref Abgr32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Abgr32 sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref destRef, i); @@ -252,7 +252,7 @@ public partial struct Abgr32 ref Abgr32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Abgr32 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -273,7 +273,7 @@ public partial struct Abgr32 ref Abgr32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Abgr32 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -294,7 +294,7 @@ public partial struct Abgr32 ref Abgr32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Abgr32 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); @@ -315,7 +315,7 @@ public partial struct Abgr32 ref Abgr32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Abgr32 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); @@ -336,7 +336,7 @@ public partial struct Abgr32 ref Abgr32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Abgr32 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs index 5dcca2ad1..e87926be8 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Argb32.PixelOperations.Generated.cs @@ -210,7 +210,7 @@ public partial struct Argb32 ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); @@ -231,7 +231,7 @@ public partial struct Argb32 ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref destRef, i); @@ -252,7 +252,7 @@ public partial struct Argb32 ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -273,7 +273,7 @@ public partial struct Argb32 ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -294,7 +294,7 @@ public partial struct Argb32 ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); @@ -315,7 +315,7 @@ public partial struct Argb32 ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); @@ -336,7 +336,7 @@ public partial struct Argb32 ref Argb32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs index dbadb8601..32eed0ce4 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgr24.PixelOperations.Generated.cs @@ -210,7 +210,7 @@ public partial struct Bgr24 ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); @@ -231,7 +231,7 @@ public partial struct Bgr24 ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref destRef, i); @@ -252,7 +252,7 @@ public partial struct Bgr24 ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -273,7 +273,7 @@ public partial struct Bgr24 ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -294,7 +294,7 @@ public partial struct Bgr24 ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); @@ -315,7 +315,7 @@ public partial struct Bgr24 ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); @@ -336,7 +336,7 @@ public partial struct Bgr24 ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs index b3643313c..4e7800c62 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra32.PixelOperations.Generated.cs @@ -210,7 +210,7 @@ public partial struct Bgra32 ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); @@ -231,7 +231,7 @@ public partial struct Bgra32 ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref destRef, i); @@ -252,7 +252,7 @@ public partial struct Bgra32 ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -273,7 +273,7 @@ public partial struct Bgra32 ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -294,7 +294,7 @@ public partial struct Bgra32 ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); @@ -315,7 +315,7 @@ public partial struct Bgra32 ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); @@ -336,7 +336,7 @@ public partial struct Bgra32 ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs index 52022b0c7..62864ad20 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Bgra5551.PixelOperations.Generated.cs @@ -50,7 +50,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref Argb32 dp = ref Unsafe.Add(ref destRef, i); @@ -71,7 +71,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Abgr32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref Abgr32 dp = ref Unsafe.Add(ref destRef, i); @@ -92,7 +92,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); @@ -113,7 +113,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra32 dp = ref Unsafe.Add(ref destRef, i); @@ -134,7 +134,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); @@ -155,7 +155,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref destRef, i); @@ -176,7 +176,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -197,7 +197,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -218,7 +218,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); @@ -239,7 +239,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); @@ -260,7 +260,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); @@ -281,7 +281,7 @@ public partial struct Bgra5551 ref Bgra5551 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs index a1a59727f..b37d9d86a 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L16.PixelOperations.Generated.cs @@ -50,7 +50,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Argb32 dp = ref Unsafe.Add(ref destRef, i); @@ -71,7 +71,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Abgr32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Abgr32 dp = ref Unsafe.Add(ref destRef, i); @@ -92,7 +92,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); @@ -113,7 +113,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra32 dp = ref Unsafe.Add(ref destRef, i); @@ -134,7 +134,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); @@ -155,7 +155,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -176,7 +176,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -197,7 +197,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); @@ -218,7 +218,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); @@ -239,7 +239,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); @@ -260,7 +260,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); @@ -281,7 +281,7 @@ public partial struct L16 ref L16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs index f0ada6459..9d67d8741 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/L8.PixelOperations.Generated.cs @@ -50,7 +50,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Argb32 dp = ref Unsafe.Add(ref destRef, i); @@ -71,7 +71,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Abgr32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Abgr32 dp = ref Unsafe.Add(ref destRef, i); @@ -92,7 +92,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); @@ -113,7 +113,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra32 dp = ref Unsafe.Add(ref destRef, i); @@ -134,7 +134,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref destRef, i); @@ -155,7 +155,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -176,7 +176,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -197,7 +197,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); @@ -218,7 +218,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); @@ -239,7 +239,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); @@ -260,7 +260,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); @@ -281,7 +281,7 @@ public partial struct L8 ref L8 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs index d0610037d..5afea8202 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/La16.PixelOperations.Generated.cs @@ -50,7 +50,7 @@ public partial struct La16 ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref La16 sp = ref Unsafe.Add(ref sourceRef, i); ref Argb32 dp = ref Unsafe.Add(ref destRef, i); @@ -71,7 +71,7 @@ public partial struct La16 ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Abgr32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref La16 sp = ref Unsafe.Add(ref sourceRef, i); ref Abgr32 dp = ref Unsafe.Add(ref destRef, i); @@ -92,7 +92,7 @@ public partial struct La16 ref La16 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref La16 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs index fd1cfd74d..519f1a693 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb24.PixelOperations.Generated.cs @@ -210,7 +210,7 @@ public partial struct Rgb24 ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); @@ -231,7 +231,7 @@ public partial struct Rgb24 ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref destRef, i); @@ -252,7 +252,7 @@ public partial struct Rgb24 ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -273,7 +273,7 @@ public partial struct Rgb24 ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -294,7 +294,7 @@ public partial struct Rgb24 ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destRef, i); @@ -315,7 +315,7 @@ public partial struct Rgb24 ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); @@ -336,7 +336,7 @@ public partial struct Rgb24 ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs index 417ed3433..e58818dea 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/Rgb48.PixelOperations.Generated.cs @@ -50,7 +50,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref Argb32 dp = ref Unsafe.Add(ref destRef, i); @@ -71,7 +71,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Abgr32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref Abgr32 dp = ref Unsafe.Add(ref destRef, i); @@ -92,7 +92,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgr24 dp = ref Unsafe.Add(ref destRef, i); @@ -113,7 +113,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra32 dp = ref Unsafe.Add(ref destRef, i); @@ -134,7 +134,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref destRef, i); @@ -155,7 +155,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref destRef, i); @@ -176,7 +176,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref La16 dp = ref Unsafe.Add(ref destRef, i); @@ -197,7 +197,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref La32 dp = ref Unsafe.Add(ref destRef, i); @@ -218,7 +218,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgb24 dp = ref Unsafe.Add(ref destRef, i); @@ -239,7 +239,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba32 dp = ref Unsafe.Add(ref destRef, i); @@ -260,7 +260,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destRef, i); @@ -281,7 +281,7 @@ public partial struct Rgb48 ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude index ab08bfa57..5a5d135db 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/Generated/_Common.ttinclude @@ -103,7 +103,7 @@ using SixLabors.ImageSharp.PixelFormats.Utils; ref <#=fromPixelType#> sourceRef = ref MemoryMarshal.GetReference(sourcePixels); ref <#=toPixelType#> destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (nint i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref <#=fromPixelType#> sp = ref Unsafe.Add(ref sourceRef, i); ref <#=toPixelType#> dp = ref Unsafe.Add(ref destRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/RgbaVector.PixelOperations.cs b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/RgbaVector.PixelOperations.cs index 3fcb4bc61..ed1d3cb2b 100644 --- a/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/RgbaVector.PixelOperations.cs +++ b/src/ImageSharp/PixelFormats/PixelImplementations/PixelOperations/RgbaVector.PixelOperations.cs @@ -72,7 +72,7 @@ public partial struct RgbaVector ref Vector4 sourceBaseRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels)); ref L8 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Vector4 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref L8 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -91,7 +91,7 @@ public partial struct RgbaVector ref Vector4 sourceBaseRef = ref Unsafe.As(ref MemoryMarshal.GetReference(sourcePixels)); ref L16 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref Vector4 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref L16 dp = ref Unsafe.Add(ref destBaseRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs index a4c2fb7a0..26ca4d1b5 100644 --- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs +++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.cs @@ -22,7 +22,7 @@ public partial class PixelOperations ref Argb32 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Argb32 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -58,7 +58,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Argb32 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Argb32 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -94,7 +94,7 @@ public partial class PixelOperations ref Abgr32 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Abgr32 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -130,7 +130,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Abgr32 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Abgr32 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -166,7 +166,7 @@ public partial class PixelOperations ref Bgr24 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Bgr24 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -202,7 +202,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgr24 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Bgr24 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -238,7 +238,7 @@ public partial class PixelOperations ref Bgra32 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Bgra32 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -274,7 +274,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra32 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Bgra32 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -310,7 +310,7 @@ public partial class PixelOperations ref L8 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref L8 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -346,7 +346,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref L8 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref L8 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -382,7 +382,7 @@ public partial class PixelOperations ref L16 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref L16 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -418,7 +418,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref L16 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref L16 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -454,7 +454,7 @@ public partial class PixelOperations ref La16 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref La16 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -490,7 +490,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref La16 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref La16 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -526,7 +526,7 @@ public partial class PixelOperations ref La32 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref La32 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -562,7 +562,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref La32 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref La32 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -598,7 +598,7 @@ public partial class PixelOperations ref Rgb24 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Rgb24 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -634,7 +634,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb24 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Rgb24 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -670,7 +670,7 @@ public partial class PixelOperations ref Rgba32 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Rgba32 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -706,7 +706,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba32 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Rgba32 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -742,7 +742,7 @@ public partial class PixelOperations ref Rgb48 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Rgb48 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -778,7 +778,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgb48 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Rgb48 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -814,7 +814,7 @@ public partial class PixelOperations ref Rgba64 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Rgba64 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -850,7 +850,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Rgba64 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Rgba64 dp = ref Unsafe.Add(ref destBaseRef, i); @@ -886,7 +886,7 @@ public partial class PixelOperations ref Bgra5551 sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Bgra5551 sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -922,7 +922,7 @@ public partial class PixelOperations ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref Bgra5551 destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref Bgra5551 dp = ref Unsafe.Add(ref destBaseRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.tt b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.tt index 31bd0ce6d..39cf873bf 100644 --- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.tt +++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.Generated.tt @@ -28,7 +28,7 @@ ref <#=pixelType#> sourceBaseRef = ref MemoryMarshal.GetReference(source); ref TPixel destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref <#=pixelType#> sp = ref Unsafe.Add(ref sourceBaseRef, i); ref TPixel dp = ref Unsafe.Add(ref destBaseRef, i); @@ -70,7 +70,7 @@ ref TPixel sourceBaseRef = ref MemoryMarshal.GetReference(sourcePixels); ref <#=pixelType#> destBaseRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < sourcePixels.Length; i++) + for (nint i = 0; i < (uint)sourcePixels.Length; i++) { ref TPixel sp = ref Unsafe.Add(ref sourceBaseRef, i); ref <#=pixelType#> dp = ref Unsafe.Add(ref destBaseRef, i); diff --git a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs index 2465493f5..b18e38f4d 100644 --- a/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs +++ b/src/ImageSharp/PixelFormats/PixelOperations{TPixel}.cs @@ -187,7 +187,7 @@ public partial class PixelOperations ref byte b = ref MemoryMarshal.GetReference(blueChannel); ref TPixel d = ref MemoryMarshal.GetReference(destination); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { rgb24.R = Unsafe.Add(ref r, i); rgb24.G = Unsafe.Add(ref g, i); @@ -218,7 +218,7 @@ public partial class PixelOperations ref float g = ref MemoryMarshal.GetReference(greenChannel); ref float b = ref MemoryMarshal.GetReference(blueChannel); ref TPixel src = ref MemoryMarshal.GetReference(source); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref src, i).ToRgba32(ref rgba32); Unsafe.Add(ref r, i) = rgba32.R; diff --git a/src/ImageSharp/PixelFormats/Utils/Vector4Converters.Default.cs b/src/ImageSharp/PixelFormats/Utils/Vector4Converters.Default.cs index 251f8d64d..4d07a8a9b 100644 --- a/src/ImageSharp/PixelFormats/Utils/Vector4Converters.Default.cs +++ b/src/ImageSharp/PixelFormats/Utils/Vector4Converters.Default.cs @@ -1,4 +1,4 @@ -// Copyright (c) Six Labors. +// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.Numerics; @@ -88,7 +88,7 @@ internal static partial class Vector4Converters where TPixel : unmanaged, IPixel { ref Vector4 sourceStart = ref MemoryMarshal.GetReference(sourceVectors); - ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceStart, sourceVectors.Length); + ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceStart, (uint)sourceVectors.Length); ref TPixel destRef = ref MemoryMarshal.GetReference(destPixels); while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd)) @@ -107,7 +107,7 @@ internal static partial class Vector4Converters where TPixel : unmanaged, IPixel { ref TPixel sourceStart = ref MemoryMarshal.GetReference(sourcePixels); - ref TPixel sourceEnd = ref Unsafe.Add(ref sourceStart, sourcePixels.Length); + ref TPixel sourceEnd = ref Unsafe.Add(ref sourceStart, (uint)sourcePixels.Length); ref Vector4 destRef = ref MemoryMarshal.GetReference(destVectors); while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd)) @@ -126,7 +126,7 @@ internal static partial class Vector4Converters where TPixel : unmanaged, IPixel { ref Vector4 sourceStart = ref MemoryMarshal.GetReference(sourceVectors); - ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceStart, sourceVectors.Length); + ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceStart, (uint)sourceVectors.Length); ref TPixel destRef = ref MemoryMarshal.GetReference(destinationColors); while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd)) @@ -145,7 +145,7 @@ internal static partial class Vector4Converters where TPixel : unmanaged, IPixel { ref TPixel sourceStart = ref MemoryMarshal.GetReference(sourceColors); - ref TPixel sourceEnd = ref Unsafe.Add(ref sourceStart, sourceColors.Length); + ref TPixel sourceEnd = ref Unsafe.Add(ref sourceStart, (uint)sourceColors.Length); ref Vector4 destRef = ref MemoryMarshal.GetReference(destinationVectors); while (Unsafe.IsAddressLessThan(ref sourceStart, ref sourceEnd)) diff --git a/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs index 0ceb5bc13..04653bd6e 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor.cs @@ -128,19 +128,19 @@ public sealed class BokehBlurProcessor : IImageProcessor int boundsWidth = this.bounds.Width; int kernelSize = this.kernel.Length; - ref int sampleRowBase = ref Unsafe.Add(ref MemoryMarshal.GetReference(this.map.GetRowOffsetSpan()), (y - this.bounds.Y) * kernelSize); + ref int sampleRowBase = ref Unsafe.Add(ref MemoryMarshal.GetReference(this.map.GetRowOffsetSpan()), (uint)((y - this.bounds.Y) * kernelSize)); // The target buffer is zeroed initially and then it accumulates the results // of each partial convolution, so we don't have to clear it here as well ref Vector4 targetBase = ref this.targetValues.GetElementUnsafe(boundsX, y); ref Complex64 kernelStart = ref this.kernel[0]; - ref Complex64 kernelEnd = ref Unsafe.Add(ref kernelStart, kernelSize); + ref Complex64 kernelEnd = ref Unsafe.Add(ref kernelStart, (uint)kernelSize); while (Unsafe.IsAddressLessThan(ref kernelStart, ref kernelEnd)) { // Get the precalculated source sample row for this kernel row and copy to our buffer ref ComplexVector4 sourceBase = ref this.sourceValues.GetElementUnsafe(0, sampleRowBase); - ref ComplexVector4 sourceEnd = ref Unsafe.Add(ref sourceBase, boundsWidth); + ref ComplexVector4 sourceEnd = ref Unsafe.Add(ref sourceBase, (uint)boundsWidth); ref Vector4 targetStart = ref targetBase; Complex64 factor = kernelStart; diff --git a/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs index 55c03abe6..2508a7da2 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/BokehBlurProcessor{TPixel}.cs @@ -157,8 +157,8 @@ internal class BokehBlurProcessor : ImageProcessor for (int i = 0; i < this.kernels.Length; i++) { // Compute the resulting complex buffer for the current component - Complex64[] kernel = Unsafe.Add(ref baseRef, i); - Vector4 parameters = Unsafe.Add(ref paramsRef, i); + Complex64[] kernel = Unsafe.Add(ref baseRef, (uint)i); + Vector4 parameters = Unsafe.Add(ref paramsRef, (uint)i); // Horizontal convolution var horizontalOperation = new FirstPassConvolutionRowOperation( @@ -243,9 +243,9 @@ internal class BokehBlurProcessor : ImageProcessor ref Vector4 sourceBase = ref MemoryMarshal.GetReference(span); ref ComplexVector4 targetStart = ref MemoryMarshal.GetReference(targetBuffer); - ref ComplexVector4 targetEnd = ref Unsafe.Add(ref targetStart, span.Length); + ref ComplexVector4 targetEnd = ref Unsafe.Add(ref targetStart, (uint)span.Length); ref Complex64 kernelBase = ref this.kernel[0]; - ref Complex64 kernelEnd = ref Unsafe.Add(ref kernelBase, kernelSize); + ref Complex64 kernelEnd = ref Unsafe.Add(ref kernelBase, (uint)kernelSize); ref int sampleColumnBase = ref MemoryMarshal.GetReference(this.map.GetColumnOffsetSpan()); while (Unsafe.IsAddressLessThan(ref targetStart, ref targetEnd)) @@ -255,7 +255,7 @@ internal class BokehBlurProcessor : ImageProcessor while (Unsafe.IsAddressLessThan(ref kernelStart, ref kernelEnd)) { - Vector4 sample = Unsafe.Add(ref sourceBase, sampleColumnStart - boundsX); + Vector4 sample = Unsafe.Add(ref sourceBase, (uint)(sampleColumnStart - boundsX)); targetStart.Sum(kernelStart * sample); @@ -265,7 +265,7 @@ internal class BokehBlurProcessor : ImageProcessor // Shift the base column sampling reference by one row at the end of each outer // iteration so that the inner tight loop indexing can skip the multiplication - sampleColumnBase = ref Unsafe.Add(ref sampleColumnBase, kernelSize); + sampleColumnBase = ref Unsafe.Add(ref sampleColumnBase, (uint)kernelSize); targetStart = ref Unsafe.Add(ref targetStart, 1); } } @@ -309,7 +309,7 @@ internal class BokehBlurProcessor : ImageProcessor for (int x = 0; x < this.bounds.Width; x++) { - ref Vector4 v = ref Unsafe.Add(ref baseRef, x); + ref Vector4 v = ref Unsafe.Add(ref baseRef, (uint)x); v.X = MathF.Pow(v.X, this.gamma); v.Y = MathF.Pow(v.Y, this.gamma); v.Z = MathF.Pow(v.Z, this.gamma); @@ -399,7 +399,7 @@ internal class BokehBlurProcessor : ImageProcessor for (int x = 0; x < this.bounds.Width; x++) { - ref Vector4 v = ref Unsafe.Add(ref sourceRef, x); + ref Vector4 v = ref Unsafe.Add(ref sourceRef, (uint)x); Vector4 clamp = Numerics.Clamp(v, low, high); v.X = MathF.Pow(clamp.X, this.inverseGamma); v.Y = MathF.Pow(clamp.Y, this.inverseGamma); diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DRowOperation{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DRowOperation{TPixel}.cs index e5963bd39..91fc3a1b1 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2DRowOperation{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2DRowOperation{TPixel}.cs @@ -90,7 +90,7 @@ internal readonly struct Convolution2DRowOperation : IRowOperation.Instance.ToVector4(this.configuration, sourceRow, sourceBuffer); @@ -99,13 +99,13 @@ internal readonly struct Convolution2DRowOperation : IRowOperation : IRowOperation targetRowSpan = this.targetPixels.DangerousGetRowSpan(y).Slice(boundsX, boundsWidth); @@ -155,7 +155,7 @@ internal readonly struct Convolution2DRowOperation : IRowOperation sourceRow = this.sourcePixels.DangerousGetRowSpan(sampleY).Slice(boundsX, boundsWidth); PixelOperations.Instance.ToVector4(this.configuration, sourceRow, sourceBuffer); @@ -165,13 +165,13 @@ internal readonly struct Convolution2DRowOperation : IRowOperation : IRowOperation ref Unsafe.Add(ref MemoryMarshal.GetReference(this.rowOffsetMap), row * this.kernelHeight); + => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.rowOffsetMap), (uint)(row * this.kernelHeight)); [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly ref int GetSampleColumn(int column) - => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.columnOffsetMap), column * this.kernelWidth); + => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.columnOffsetMap), (uint)(column * this.kernelWidth)); } diff --git a/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs index 094a96f78..b09db9fa0 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Convolution2PassProcessor{TPixel}.cs @@ -178,9 +178,9 @@ internal class Convolution2PassProcessor : ImageProcessor ref Vector4 sourceBase = ref MemoryMarshal.GetReference(sourceBuffer); ref Vector4 targetStart = ref MemoryMarshal.GetReference(targetBuffer); - ref Vector4 targetEnd = ref Unsafe.Add(ref targetStart, sourceBuffer.Length); + ref Vector4 targetEnd = ref Unsafe.Add(ref targetStart, (uint)sourceBuffer.Length); ref float kernelBase = ref this.kernel[0]; - ref float kernelEnd = ref Unsafe.Add(ref kernelBase, kernelSize); + ref float kernelEnd = ref Unsafe.Add(ref kernelBase, (uint)kernelSize); ref int sampleColumnBase = ref MemoryMarshal.GetReference(this.map.GetColumnOffsetSpan()); while (Unsafe.IsAddressLessThan(ref targetStart, ref targetEnd)) @@ -190,7 +190,7 @@ internal class Convolution2PassProcessor : ImageProcessor while (Unsafe.IsAddressLessThan(ref kernelStart, ref kernelEnd)) { - Vector4 sample = Unsafe.Add(ref sourceBase, sampleColumnStart - boundsX); + Vector4 sample = Unsafe.Add(ref sourceBase, (uint)(sampleColumnStart - boundsX)); targetStart += kernelStart * sample; @@ -199,7 +199,7 @@ internal class Convolution2PassProcessor : ImageProcessor } targetStart = ref Unsafe.Add(ref targetStart, 1); - sampleColumnBase = ref Unsafe.Add(ref sampleColumnBase, kernelSize); + sampleColumnBase = ref Unsafe.Add(ref sampleColumnBase, (uint)kernelSize); } // Now we need to copy the original alpha values from the source row. @@ -242,9 +242,9 @@ internal class Convolution2PassProcessor : ImageProcessor ref Vector4 sourceBase = ref MemoryMarshal.GetReference(sourceBuffer); ref Vector4 targetStart = ref MemoryMarshal.GetReference(targetBuffer); - ref Vector4 targetEnd = ref Unsafe.Add(ref targetStart, sourceBuffer.Length); + ref Vector4 targetEnd = ref Unsafe.Add(ref targetStart, (uint)sourceBuffer.Length); ref float kernelBase = ref this.kernel[0]; - ref float kernelEnd = ref Unsafe.Add(ref kernelBase, kernelSize); + ref float kernelEnd = ref Unsafe.Add(ref kernelBase, (uint)kernelSize); ref int sampleColumnBase = ref MemoryMarshal.GetReference(this.map.GetColumnOffsetSpan()); while (Unsafe.IsAddressLessThan(ref targetStart, ref targetEnd)) @@ -254,7 +254,7 @@ internal class Convolution2PassProcessor : ImageProcessor while (Unsafe.IsAddressLessThan(ref kernelStart, ref kernelEnd)) { - Vector4 sample = Unsafe.Add(ref sourceBase, sampleColumnStart - boundsX); + Vector4 sample = Unsafe.Add(ref sourceBase, (uint)(sampleColumnStart - boundsX)); targetStart += kernelStart * sample; @@ -263,7 +263,7 @@ internal class Convolution2PassProcessor : ImageProcessor } targetStart = ref Unsafe.Add(ref targetStart, 1); - sampleColumnBase = ref Unsafe.Add(ref sampleColumnBase, kernelSize); + sampleColumnBase = ref Unsafe.Add(ref sampleColumnBase, (uint)kernelSize); } Numerics.UnPremultiply(targetBuffer); @@ -335,14 +335,14 @@ internal class Convolution2PassProcessor : ImageProcessor Span sourceBuffer = span[..this.bounds.Width]; Span targetBuffer = span[this.bounds.Width..]; - ref int sampleRowBase = ref Unsafe.Add(ref MemoryMarshal.GetReference(this.map.GetRowOffsetSpan()), (y - this.bounds.Y) * kernelSize); + ref int sampleRowBase = ref Unsafe.Add(ref MemoryMarshal.GetReference(this.map.GetRowOffsetSpan()), (uint)((y - this.bounds.Y) * kernelSize)); // Clear the target buffer for each row run. targetBuffer.Clear(); ref Vector4 targetBase = ref MemoryMarshal.GetReference(targetBuffer); ref float kernelStart = ref this.kernel[0]; - ref float kernelEnd = ref Unsafe.Add(ref kernelStart, kernelSize); + ref float kernelEnd = ref Unsafe.Add(ref kernelStart, (uint)kernelSize); Span sourceRow; while (Unsafe.IsAddressLessThan(ref kernelStart, ref kernelEnd)) @@ -353,7 +353,7 @@ internal class Convolution2PassProcessor : ImageProcessor PixelOperations.Instance.ToVector4(this.configuration, sourceRow, sourceBuffer); ref Vector4 sourceBase = ref MemoryMarshal.GetReference(sourceBuffer); - ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceBase, sourceBuffer.Length); + ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceBase, (uint)sourceBuffer.Length); ref Vector4 targetStart = ref targetBase; float factor = kernelStart; @@ -374,7 +374,7 @@ internal class Convolution2PassProcessor : ImageProcessor PixelOperations.Instance.ToVector4(this.configuration, sourceRow, sourceBuffer); { ref Vector4 sourceBase = ref MemoryMarshal.GetReference(sourceBuffer); - ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceBase, sourceBuffer.Length); + ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceBase, (uint)sourceBuffer.Length); while (Unsafe.IsAddressLessThan(ref sourceBase, ref sourceEnd)) { @@ -400,14 +400,14 @@ internal class Convolution2PassProcessor : ImageProcessor Span sourceBuffer = span[..this.bounds.Width]; Span targetBuffer = span[this.bounds.Width..]; - ref int sampleRowBase = ref Unsafe.Add(ref MemoryMarshal.GetReference(this.map.GetRowOffsetSpan()), (y - this.bounds.Y) * kernelSize); + ref int sampleRowBase = ref Unsafe.Add(ref MemoryMarshal.GetReference(this.map.GetRowOffsetSpan()), (uint)((y - this.bounds.Y) * kernelSize)); // Clear the target buffer for each row run. targetBuffer.Clear(); ref Vector4 targetBase = ref MemoryMarshal.GetReference(targetBuffer); ref float kernelStart = ref this.kernel[0]; - ref float kernelEnd = ref Unsafe.Add(ref kernelStart, kernelSize); + ref float kernelEnd = ref Unsafe.Add(ref kernelStart, (uint)kernelSize); Span sourceRow; while (Unsafe.IsAddressLessThan(ref kernelStart, ref kernelEnd)) @@ -420,7 +420,7 @@ internal class Convolution2PassProcessor : ImageProcessor Numerics.Premultiply(sourceBuffer); ref Vector4 sourceBase = ref MemoryMarshal.GetReference(sourceBuffer); - ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceBase, sourceBuffer.Length); + ref Vector4 sourceEnd = ref Unsafe.Add(ref sourceBase, (uint)sourceBuffer.Length); ref Vector4 targetStart = ref targetBase; float factor = kernelStart; diff --git a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs index 54dad64a6..4cbca8d74 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionProcessor{TPixel}.cs @@ -135,7 +135,7 @@ internal class ConvolutionProcessor : ImageProcessor for (int kY = 0; kY < state.Kernel.Rows; kY++) { // Get the precalculated source sample row for this kernel row and copy to our buffer. - int offsetY = Unsafe.Add(ref sampleRowBase, kY); + int offsetY = Unsafe.Add(ref sampleRowBase, (uint)kY); sourceRow = this.sourcePixels.DangerousGetRowSpan(offsetY).Slice(boundsX, boundsWidth); PixelOperations.Instance.ToVector4(this.configuration, sourceRow, sourceBuffer); @@ -144,12 +144,12 @@ internal class ConvolutionProcessor : ImageProcessor for (int x = 0; x < sourceBuffer.Length; x++) { ref int sampleColumnBase = ref state.GetSampleColumn(x); - ref Vector4 target = ref Unsafe.Add(ref targetBase, x); + ref Vector4 target = ref Unsafe.Add(ref targetBase, (uint)x); for (int kX = 0; kX < state.Kernel.Columns; kX++) { - int offsetX = Unsafe.Add(ref sampleColumnBase, kX) - boundsX; - Vector4 sample = Unsafe.Add(ref sourceBase, offsetX); + int offsetX = Unsafe.Add(ref sampleColumnBase, (uint)kX) - boundsX; + Vector4 sample = Unsafe.Add(ref sourceBase, (uint)offsetX); target += state.Kernel[kY, kX] * sample; } } @@ -161,8 +161,8 @@ internal class ConvolutionProcessor : ImageProcessor for (int x = 0; x < sourceRow.Length; x++) { - ref Vector4 target = ref Unsafe.Add(ref targetBase, x); - target.W = Unsafe.Add(ref MemoryMarshal.GetReference(sourceBuffer), x).W; + ref Vector4 target = ref Unsafe.Add(ref targetBase, (uint)x); + target.W = Unsafe.Add(ref MemoryMarshal.GetReference(sourceBuffer), (uint)x).W; } } else @@ -174,7 +174,7 @@ internal class ConvolutionProcessor : ImageProcessor for (int kY = 0; kY < state.Kernel.Rows; kY++) { // Get the precalculated source sample row for this kernel row and copy to our buffer. - int offsetY = Unsafe.Add(ref sampleRowBase, kY); + int offsetY = Unsafe.Add(ref sampleRowBase, (uint)kY); Span sourceRow = this.sourcePixels.DangerousGetRowSpan(offsetY).Slice(boundsX, boundsWidth); PixelOperations.Instance.ToVector4(this.configuration, sourceRow, sourceBuffer); @@ -184,12 +184,12 @@ internal class ConvolutionProcessor : ImageProcessor for (int x = 0; x < sourceBuffer.Length; x++) { ref int sampleColumnBase = ref state.GetSampleColumn(x); - ref Vector4 target = ref Unsafe.Add(ref targetBase, x); + ref Vector4 target = ref Unsafe.Add(ref targetBase, (uint)x); for (int kX = 0; kX < state.Kernel.Columns; kX++) { - int offsetX = Unsafe.Add(ref sampleColumnBase, kX) - boundsX; - Vector4 sample = Unsafe.Add(ref sourceBase, offsetX); + int offsetX = Unsafe.Add(ref sampleColumnBase, (uint)kX) - boundsX; + Vector4 sample = Unsafe.Add(ref sourceBase, (uint)offsetX); target += state.Kernel[kY, kX] * sample; } } diff --git a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionState.cs b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionState.cs index 3d0e551b6..dbf90d017 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/ConvolutionState.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ConvolutionState.cs @@ -35,9 +35,9 @@ internal readonly ref struct ConvolutionState [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly ref int GetSampleRow(int row) - => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.rowOffsetMap), row * this.kernelHeight); + => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.rowOffsetMap), (uint)(row * this.kernelHeight)); [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly ref int GetSampleColumn(int column) - => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.columnOffsetMap), column * this.kernelWidth); + => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.columnOffsetMap), (uint)(column * this.kernelWidth)); } diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor{TPixel}.cs index 75e8e98e9..8de92bee8 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetectorCompassProcessor{TPixel}.cs @@ -123,8 +123,8 @@ internal class EdgeDetectorCompassProcessor : ImageProcessor for (int x = this.minX; x < this.maxX; x++) { // Grab the max components of the two pixels - ref TPixel currentPassPixel = ref Unsafe.Add(ref passPixelsBase, x); - ref TPixel currentTargetPixel = ref Unsafe.Add(ref targetPixelsBase, x); + ref TPixel currentPassPixel = ref Unsafe.Add(ref passPixelsBase, (uint)x); + ref TPixel currentTargetPixel = ref Unsafe.Add(ref targetPixelsBase, (uint)x); var pixelValue = Vector4.Max(currentPassPixel.ToVector4(), currentTargetPixel.ToVector4()); diff --git a/src/ImageSharp/Processing/Processors/Convolution/Kernel.cs b/src/ImageSharp/Processing/Processors/Convolution/Kernel.cs index 35aa933cf..b225b55e5 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Kernel.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Kernel.cs @@ -49,7 +49,7 @@ internal readonly ref struct Kernel { this.CheckCoordinates(row, column); ref T vBase = ref MemoryMarshal.GetReference(this.values); - return Unsafe.Add(ref vBase, (row * this.Columns) + column); + return Unsafe.Add(ref vBase, (uint)((row * this.Columns) + column)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -57,7 +57,7 @@ internal readonly ref struct Kernel { this.CheckCoordinates(row, column); ref T vBase = ref MemoryMarshal.GetReference(this.values); - Unsafe.Add(ref vBase, (row * this.Columns) + column) = value; + Unsafe.Add(ref vBase, (uint)((row * this.Columns) + column)) = value; } } @@ -66,7 +66,7 @@ internal readonly ref struct Kernel { this.CheckIndex(index); ref T vBase = ref MemoryMarshal.GetReference(this.values); - Unsafe.Add(ref vBase, index) = value; + Unsafe.Add(ref vBase, (uint)index) = value; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/ImageSharp/Processing/Processors/Convolution/KernelSamplingMap.cs b/src/ImageSharp/Processing/Processors/Convolution/KernelSamplingMap.cs index 8128d0119..7653aeaa9 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/KernelSamplingMap.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/KernelSamplingMap.cs @@ -92,7 +92,7 @@ internal sealed class KernelSamplingMap : IDisposable int chunkBase = chunk * kernelSize; for (int i = 0; i < kernelSize; i++) { - Unsafe.Add(ref spanBase, chunkBase + i) = chunk + i + min - radius; + Unsafe.Add(ref spanBase, (uint)(chunkBase + i)) = chunk + i + min - radius; } } diff --git a/src/ImageSharp/Processing/Processors/Convolution/MedianConvolutionState.cs b/src/ImageSharp/Processing/Processors/Convolution/MedianConvolutionState.cs index d557896e3..137334c29 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/MedianConvolutionState.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/MedianConvolutionState.cs @@ -36,9 +36,9 @@ internal readonly ref struct MedianConvolutionState [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly ref int GetSampleRow(int row) - => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.rowOffsetMap), row * this.kernelHeight); + => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.rowOffsetMap), (uint)(row * this.kernelHeight)); [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly ref int GetSampleColumn(int column) - => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.columnOffsetMap), column * this.kernelWidth); + => ref Unsafe.Add(ref MemoryMarshal.GetReference(this.columnOffsetMap), (uint)(column * this.kernelWidth)); } diff --git a/src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs b/src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs index dbb62f0c5..ca2cabab5 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/MedianRowOperation{TPixel}.cs @@ -75,7 +75,7 @@ internal readonly struct MedianRowOperation : IRowOperation // First convert the required source rows to Vector4. for (int i = 0; i < this.kernelSize; i++) { - int currentYIndex = Unsafe.Add(ref sampleRowBase, i); + int currentYIndex = Unsafe.Add(ref sampleRowBase, (uint)i); Span sourceRow = this.sourcePixels.DangerousGetRowSpan(currentYIndex).Slice(boundsX, boundsWidth); Span sourceVectorRow = sourceVectorBuffer.Slice(i * boundsWidth, boundsWidth); PixelOperations.Instance.ToVector4(this.configuration, sourceRow, sourceVectorRow); @@ -87,15 +87,15 @@ internal readonly struct MedianRowOperation : IRowOperation { int index = 0; ref int sampleColumnBase = ref state.GetSampleColumn(x); - ref Vector4 target = ref Unsafe.Add(ref targetBase, x); + ref Vector4 target = ref Unsafe.Add(ref targetBase, (uint)x); for (int kY = 0; kY < state.Kernel.Rows; kY++) { Span sourceRow = sourceVectorBuffer[(kY * boundsWidth)..]; ref Vector4 sourceRowBase = ref MemoryMarshal.GetReference(sourceRow); for (int kX = 0; kX < state.Kernel.Columns; kX++) { - int currentXIndex = Unsafe.Add(ref sampleColumnBase, kX) - boundsX; - Vector4 pixel = Unsafe.Add(ref sourceRowBase, currentXIndex); + int currentXIndex = Unsafe.Add(ref sampleColumnBase, (uint)kX) - boundsX; + Vector4 pixel = Unsafe.Add(ref sourceRowBase, (uint)currentXIndex); state.Kernel.SetValue(index, pixel); index++; } @@ -111,15 +111,15 @@ internal readonly struct MedianRowOperation : IRowOperation { int index = 0; ref int sampleColumnBase = ref state.GetSampleColumn(x); - ref Vector4 target = ref Unsafe.Add(ref targetBase, x); + ref Vector4 target = ref Unsafe.Add(ref targetBase, (uint)x); for (int kY = 0; kY < state.Kernel.Rows; kY++) { Span sourceRow = sourceVectorBuffer[(kY * boundsWidth)..]; ref Vector4 sourceRowBase = ref MemoryMarshal.GetReference(sourceRow); for (int kX = 0; kX < state.Kernel.Columns; kX++) { - int currentXIndex = Unsafe.Add(ref sampleColumnBase, kX) - boundsX; - Vector4 pixel = Unsafe.Add(ref sourceRowBase, currentXIndex); + int currentXIndex = Unsafe.Add(ref sampleColumnBase, (uint)kX) - boundsX; + Vector4 pixel = Unsafe.Add(ref sourceRowBase, (uint)currentXIndex); state.Kernel.SetValue(index, pixel); index++; } diff --git a/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelDataProvider.cs b/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelDataProvider.cs index 08dee86a4..8f501da23 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelDataProvider.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/Parameters/BokehBlurKernelDataProvider.cs @@ -134,7 +134,7 @@ internal static class BokehBlurKernelDataProvider ref Vector4 baseRef = ref MemoryMarshal.GetReference(kernelParameters.AsSpan()); for (int i = 0; i < kernelParameters.Length; i++) { - ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i); + ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, (uint)i); kernels[i] = CreateComplex1DKernel(radius, kernelSize, kernelsScale, paramsRef.X, paramsRef.Y); } @@ -167,7 +167,7 @@ internal static class BokehBlurKernelDataProvider value *= value; // Fill in the complex kernel values - Unsafe.Add(ref baseRef, i) = new Complex64( + Unsafe.Add(ref baseRef, (uint)i) = new Complex64( MathF.Exp(-a * value) * MathF.Cos(b * value), MathF.Exp(-a * value) * MathF.Sin(b * value)); } @@ -190,17 +190,17 @@ internal static class BokehBlurKernelDataProvider for (int i = 0; i < kernelParameters.Length; i++) { - ref Complex64[] kernelRef = ref Unsafe.Add(ref baseKernelsRef, i); + ref Complex64[] kernelRef = ref Unsafe.Add(ref baseKernelsRef, (uint)i); int length = kernelRef.Length; ref Complex64 valueRef = ref kernelRef[0]; - ref Vector4 paramsRef = ref Unsafe.Add(ref baseParamsRef, i); + ref Vector4 paramsRef = ref Unsafe.Add(ref baseParamsRef, (uint)i); for (int j = 0; j < length; j++) { for (int k = 0; k < length; k++) { - ref Complex64 jRef = ref Unsafe.Add(ref valueRef, j); - ref Complex64 kRef = ref Unsafe.Add(ref valueRef, k); + ref Complex64 jRef = ref Unsafe.Add(ref valueRef, (uint)j); + ref Complex64 kRef = ref Unsafe.Add(ref valueRef, (uint)k); total += (paramsRef.Z * ((jRef.Real * kRef.Real) - (jRef.Imaginary * kRef.Imaginary))) + (paramsRef.W * ((jRef.Real * kRef.Imaginary) + (jRef.Imaginary * kRef.Real))); @@ -212,13 +212,13 @@ internal static class BokehBlurKernelDataProvider float scalar = 1f / MathF.Sqrt(total); for (int i = 0; i < kernelsSpan.Length; i++) { - ref Complex64[] kernelsRef = ref Unsafe.Add(ref baseKernelsRef, i); + ref Complex64[] kernelsRef = ref Unsafe.Add(ref baseKernelsRef, (uint)i); int length = kernelsRef.Length; ref Complex64 valueRef = ref kernelsRef[0]; for (int j = 0; j < length; j++) { - Unsafe.Add(ref valueRef, j) *= scalar; + Unsafe.Add(ref valueRef, (uint)j) *= scalar; } } } diff --git a/src/ImageSharp/Processing/Processors/Convolution/ReadOnlyKernel.cs b/src/ImageSharp/Processing/Processors/Convolution/ReadOnlyKernel.cs index 641a8ae8b..46c35c62c 100644 --- a/src/ImageSharp/Processing/Processors/Convolution/ReadOnlyKernel.cs +++ b/src/ImageSharp/Processing/Processors/Convolution/ReadOnlyKernel.cs @@ -41,7 +41,7 @@ internal readonly ref struct ReadOnlyKernel { this.CheckCoordinates(row, column); ref float vBase = ref MemoryMarshal.GetReference(this.values); - return Unsafe.Add(ref vBase, (row * this.Columns) + column); + return Unsafe.Add(ref vBase, (uint)((row * this.Columns) + column)); } } diff --git a/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs b/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs index 3a869a0a2..754aac90e 100644 --- a/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs +++ b/src/ImageSharp/Processing/Processors/Dithering/ErrorDither.cs @@ -114,8 +114,8 @@ public readonly partial struct ErrorDither : IDither, IEquatable, I for (int x = bounds.Left; x < bounds.Right; x++) { - TPixel sourcePixel = Unsafe.Add(ref sourceRowRef, x); - Unsafe.Add(ref destinationRowRef, x - offsetX) = quantizer.GetQuantizedColor(sourcePixel, out TPixel transformed); + TPixel sourcePixel = Unsafe.Add(ref sourceRowRef, (uint)x); + Unsafe.Add(ref destinationRowRef, (uint)(x - offsetX)) = quantizer.GetQuantizedColor(sourcePixel, out TPixel transformed); this.Dither(source, bounds, sourcePixel, transformed, x, y, scale); } } @@ -142,7 +142,7 @@ public readonly partial struct ErrorDither : IDither, IEquatable, I ref TPixel sourceRowRef = ref MemoryMarshal.GetReference(sourceBuffer.DangerousGetRowSpan(y)); for (int x = bounds.Left; x < bounds.Right; x++) { - ref TPixel sourcePixel = ref Unsafe.Add(ref sourceRowRef, x); + ref TPixel sourcePixel = ref Unsafe.Add(ref sourceRowRef, (uint)x); TPixel transformed = Unsafe.AsRef(processor).GetPaletteColor(sourcePixel); this.Dither(source, bounds, sourcePixel, transformed, x, y, scale); sourcePixel = transformed; diff --git a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs index 67964f0eb..6352230de 100644 --- a/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Effects/OilPaintingProcessor{TPixel}.cs @@ -107,9 +107,9 @@ internal class OilPaintingProcessor : ImageProcessor ref float binsRef = ref bins.GetReference(); ref int intensityBinRef = ref Unsafe.As(ref binsRef); - ref float redBinRef = ref Unsafe.Add(ref binsRef, this.levels); - ref float blueBinRef = ref Unsafe.Add(ref redBinRef, this.levels); - ref float greenBinRef = ref Unsafe.Add(ref blueBinRef, this.levels); + ref float redBinRef = ref Unsafe.Add(ref binsRef, (uint)this.levels); + ref float blueBinRef = ref Unsafe.Add(ref redBinRef, (uint)this.levels); + ref float greenBinRef = ref Unsafe.Add(ref blueBinRef, (uint)this.levels); for (int y = rows.Min; y < rows.Max; y++) { @@ -148,21 +148,21 @@ internal class OilPaintingProcessor : ImageProcessor int currentIntensity = (int)MathF.Round((sourceBlue + sourceGreen + sourceRed) / 3F * (this.levels - 1)); - Unsafe.Add(ref intensityBinRef, currentIntensity)++; - Unsafe.Add(ref redBinRef, currentIntensity) += sourceRed; - Unsafe.Add(ref blueBinRef, currentIntensity) += sourceBlue; - Unsafe.Add(ref greenBinRef, currentIntensity) += sourceGreen; + Unsafe.Add(ref intensityBinRef, (uint)currentIntensity)++; + Unsafe.Add(ref redBinRef, (uint)currentIntensity) += sourceRed; + Unsafe.Add(ref blueBinRef, (uint)currentIntensity) += sourceBlue; + Unsafe.Add(ref greenBinRef, (uint)currentIntensity) += sourceGreen; - if (Unsafe.Add(ref intensityBinRef, currentIntensity) > maxIntensity) + if (Unsafe.Add(ref intensityBinRef, (uint)currentIntensity) > maxIntensity) { - maxIntensity = Unsafe.Add(ref intensityBinRef, currentIntensity); + maxIntensity = Unsafe.Add(ref intensityBinRef, (uint)currentIntensity); maxIndex = currentIntensity; } } - float red = MathF.Abs(Unsafe.Add(ref redBinRef, maxIndex) / maxIntensity); - float blue = MathF.Abs(Unsafe.Add(ref blueBinRef, maxIndex) / maxIntensity); - float green = MathF.Abs(Unsafe.Add(ref greenBinRef, maxIndex) / maxIntensity); + float red = MathF.Abs(Unsafe.Add(ref redBinRef, (uint)maxIndex) / maxIntensity); + float blue = MathF.Abs(Unsafe.Add(ref blueBinRef, (uint)maxIndex) / maxIntensity); + float green = MathF.Abs(Unsafe.Add(ref greenBinRef, (uint)maxIndex) / maxIntensity); float alpha = sourceRowVector4Span[x].W; targetRowVector4Span[x] = new Vector4(red, green, blue, alpha); diff --git a/src/ImageSharp/Processing/Processors/Filters/OpaqueProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Filters/OpaqueProcessor{TPixel}.cs index 4b8fd9056..93e600106 100644 --- a/src/ImageSharp/Processing/Processors/Filters/OpaqueProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Filters/OpaqueProcessor{TPixel}.cs @@ -61,7 +61,7 @@ internal sealed class OpaqueProcessor : ImageProcessor for (int x = 0; x < this.bounds.Width; x++) { - ref Vector4 v = ref Unsafe.Add(ref baseRef, x); + ref Vector4 v = ref Unsafe.Add(ref baseRef, (uint)x); v.W = 1F; } diff --git a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs index 3aaf2631a..f25db12c2 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AdaptiveHistogramEqualizationSlidingWindowProcessor{TPixel}.cs @@ -256,8 +256,8 @@ internal class AdaptiveHistogramEqualizationSlidingWindowProcessor : His { for (nint idx = 0; idx < length; idx++) { - int luminance = ColorNumerics.GetBT709Luminance(ref Unsafe.Add(ref greyValuesBase, idx), luminanceLevels); - Unsafe.Add(ref histogramBase, luminance)++; + int luminance = ColorNumerics.GetBT709Luminance(ref Unsafe.Add(ref greyValuesBase, (uint)idx), luminanceLevels); + Unsafe.Add(ref histogramBase, (uint)luminance)++; } } @@ -273,8 +273,8 @@ internal class AdaptiveHistogramEqualizationSlidingWindowProcessor : His { for (int idx = 0; idx < length; idx++) { - int luminance = ColorNumerics.GetBT709Luminance(ref Unsafe.Add(ref greyValuesBase, idx), luminanceLevels); - Unsafe.Add(ref histogramBase, luminance)--; + int luminance = ColorNumerics.GetBT709Luminance(ref Unsafe.Add(ref greyValuesBase, (uint)idx), luminanceLevels); + Unsafe.Add(ref histogramBase, (uint)luminance)--; } } @@ -382,7 +382,7 @@ internal class AdaptiveHistogramEqualizationSlidingWindowProcessor : His // Map the current pixel to the new equalized value. int luminance = GetLuminance(this.source[x, y], this.processor.LuminanceLevels); - float luminanceEqualized = Unsafe.Add(ref cdfBase, luminance) / numberOfPixelsMinusCdfMin; + float luminanceEqualized = Unsafe.Add(ref cdfBase, (uint)luminance) / numberOfPixelsMinusCdfMin; this.targetPixels[x, y].FromVector4(new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, this.source[x, y].ToVector4().W)); // Remove top most row from the histogram, mirroring rows which exceeds the borders. diff --git a/src/ImageSharp/Processing/Processors/Normalization/AutoLevelProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/AutoLevelProcessor{TPixel}.cs index c07ac3aa3..6f4493f95 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/AutoLevelProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/AutoLevelProcessor{TPixel}.cs @@ -148,12 +148,12 @@ internal class AutoLevelProcessor : HistogramEqualizationProcessor.Instance.FromVector4Destructive(this.configuration, vectorBuffer, pixelRow); @@ -209,7 +209,7 @@ internal class AutoLevelProcessor : HistogramEqualizationProcessor : HistogramEqualizationProcessor.Instance.FromVector4Destructive(this.configuration, vectorBuffer, pixelRow); diff --git a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs index 7e9e06464..e7433899b 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/GlobalHistogramEqualizationProcessor{TPixel}.cs @@ -129,10 +129,10 @@ internal class GlobalHistogramEqualizationProcessor : HistogramEqualizat for (int x = 0; x < this.bounds.Width; x++) { - var vector = Unsafe.Add(ref vectorRef, x); + var vector = Unsafe.Add(ref vectorRef, (uint)x); int luminance = ColorNumerics.GetBT709Luminance(ref vector, levels); - float luminanceEqualized = Unsafe.Add(ref cdfBase, luminance) / noOfPixelsMinusCdfMin; - Unsafe.Add(ref vectorRef, x) = new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, vector.W); + float luminanceEqualized = Unsafe.Add(ref cdfBase, (uint)luminance) / noOfPixelsMinusCdfMin; + Unsafe.Add(ref vectorRef, (uint)x) = new Vector4(luminanceEqualized, luminanceEqualized, luminanceEqualized, vector.W); } PixelOperations.Instance.FromVector4Destructive(this.configuration, vectorBuffer, pixelRow); diff --git a/src/ImageSharp/Processing/Processors/Normalization/GrayscaleLevelsRowOperation{TPixel}.cs b/src/ImageSharp/Processing/Processors/Normalization/GrayscaleLevelsRowOperation{TPixel}.cs index 8895fdc61..0a8690ba7 100644 --- a/src/ImageSharp/Processing/Processors/Normalization/GrayscaleLevelsRowOperation{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Normalization/GrayscaleLevelsRowOperation{TPixel}.cs @@ -56,9 +56,9 @@ internal readonly struct GrayscaleLevelsRowOperation : IRowOperation : ImageProcessor< int cdfMin = 0; bool cdfMinFound = false; - for (int i = 0; i <= maxIdx; i++) + for (nint i = 0; i <= (uint)maxIdx; i++) { histSum += Unsafe.Add(ref histogramBase, i); if (!cdfMinFound && histSum != 0) @@ -101,7 +101,7 @@ internal abstract class HistogramEqualizationProcessor : ImageProcessor< int sumOverClip = 0; ref int histogramBase = ref MemoryMarshal.GetReference(histogram); - for (int i = 0; i < histogram.Length; i++) + for (nint i = 0; i < (uint)histogram.Length; i++) { ref int histogramLevel = ref Unsafe.Add(ref histogramBase, i); if (histogramLevel > clipLimit) @@ -115,7 +115,7 @@ internal abstract class HistogramEqualizationProcessor : ImageProcessor< int addToEachBin = sumOverClip > 0 ? (int)MathF.Floor(sumOverClip / this.luminanceLevelsFloat) : 0; if (addToEachBin > 0) { - for (int i = 0; i < histogram.Length; i++) + for (nint i = 0; i < (uint)histogram.Length; i++) { Unsafe.Add(ref histogramBase, i) += addToEachBin; } @@ -125,7 +125,7 @@ internal abstract class HistogramEqualizationProcessor : ImageProcessor< if (residual != 0) { int residualStep = Math.Max(this.LuminanceLevels / residual, 1); - for (int i = 0; i < this.LuminanceLevels && residual > 0; i += residualStep, residual--) + for (nint i = 0; i < (uint)this.LuminanceLevels && residual > 0; i += residualStep, residual--) { ref int histogramLevel = ref Unsafe.Add(ref histogramBase, i); histogramLevel++; diff --git a/src/ImageSharp/Processing/Processors/Quantization/EuclideanPixelMap{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/EuclideanPixelMap{TPixel}.cs index a8cf4d3e9..786248339 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/EuclideanPixelMap{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/EuclideanPixelMap{TPixel}.cs @@ -75,7 +75,7 @@ internal sealed class EuclideanPixelMap : IDisposable return this.GetClosestColorSlow(rgba, ref paletteRef, out match); } - match = Unsafe.Add(ref paletteRef, index); + match = Unsafe.Add(ref paletteRef, (ushort)index); return index; } @@ -119,7 +119,7 @@ internal sealed class EuclideanPixelMap : IDisposable // Now I have the index, pop it into the cache for next time this.cache.Add(rgba, (byte)index); - match = Unsafe.Add(ref paletteRef, index); + match = Unsafe.Add(ref paletteRef, (uint)index); return index; } diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs index 5cd9976a5..10525641c 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs @@ -134,7 +134,7 @@ internal sealed class ResizeWorker : IDisposable for (nint x = 0; x < (right - left); x++) { - ref Vector4 firstPassColumnBase = ref Unsafe.Add(ref fpBase, x * this.workerHeight); + ref Vector4 firstPassColumnBase = ref Unsafe.Add(ref fpBase, x * (nint)(uint)this.workerHeight); // Destination color components Unsafe.Add(ref tempRowBase, x) = kernel.ConvolveCore(ref firstPassColumnBase); @@ -186,13 +186,13 @@ internal sealed class ResizeWorker : IDisposable // Span firstPassSpan = transposedFirstPassBufferSpan.Slice(y - this.currentWindow.Min); ref Vector4 firstPassBaseRef = ref transposedFirstPassBufferSpan[y - this.currentWindow.Min]; - for (nint x = left, z = 0; x < right; x++, z++) + for (nint x = left, z = 0; x < (nint)(uint)right; x++, z++) { ResizeKernel kernel = this.horizontalKernelMap.GetKernel(x - targetOriginX); // optimization for: // firstPassSpan[x * this.workerHeight] = kernel.Convolve(tempRowSpan); - Unsafe.Add(ref firstPassBaseRef, z * this.workerHeight) = kernel.Convolve(tempRowSpan); + Unsafe.Add(ref firstPassBaseRef, z * (nint)(uint)this.workerHeight) = kernel.Convolve(tempRowSpan); } } } diff --git a/tests/ImageSharp.Benchmarks/Bulk/FromVector4.cs b/tests/ImageSharp.Benchmarks/Bulk/FromVector4.cs index 0637b3334..ed129fca2 100644 --- a/tests/ImageSharp.Benchmarks/Bulk/FromVector4.cs +++ b/tests/ImageSharp.Benchmarks/Bulk/FromVector4.cs @@ -47,7 +47,7 @@ public abstract class FromVector4 { ref Vector4 s = ref MemoryMarshal.GetReference(this.source.GetSpan()); ref TPixel d = ref MemoryMarshal.GetReference(this.destination.GetSpan()); - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { Unsafe.Add(ref d, i).FromVector4(Unsafe.Add(ref s, i)); } diff --git a/tests/ImageSharp.Benchmarks/Bulk/PremultiplyVector4.cs b/tests/ImageSharp.Benchmarks/Bulk/PremultiplyVector4.cs index d22fc18ac..355216de3 100644 --- a/tests/ImageSharp.Benchmarks/Bulk/PremultiplyVector4.cs +++ b/tests/ImageSharp.Benchmarks/Bulk/PremultiplyVector4.cs @@ -17,7 +17,7 @@ public class PremultiplyVector4 { ref Vector4 baseRef = ref MemoryMarshal.GetReference(Vectors); - for (int i = 0; i < Vectors.Length; i++) + for (nint i = 0; i < (uint)Vectors.Length; i++) { ref Vector4 v = ref Unsafe.Add(ref baseRef, i); Premultiply(ref v); @@ -29,7 +29,7 @@ public class PremultiplyVector4 { ref Vector4 baseRef = ref MemoryMarshal.GetReference(Vectors); - for (int i = 0; i < Vectors.Length; i++) + for (nint i = 0; i < (uint)Vectors.Length; i++) { ref Vector4 v = ref Unsafe.Add(ref baseRef, i); Numerics.Premultiply(ref v); diff --git a/tests/ImageSharp.Benchmarks/Bulk/UnPremultiplyVector4.cs b/tests/ImageSharp.Benchmarks/Bulk/UnPremultiplyVector4.cs index 3dc8fdc9c..309eea34f 100644 --- a/tests/ImageSharp.Benchmarks/Bulk/UnPremultiplyVector4.cs +++ b/tests/ImageSharp.Benchmarks/Bulk/UnPremultiplyVector4.cs @@ -17,7 +17,7 @@ public class UnPremultiplyVector4 { ref Vector4 baseRef = ref MemoryMarshal.GetReference(Vectors); - for (int i = 0; i < Vectors.Length; i++) + for (nint i = 0; i < (uint)Vectors.Length; i++) { ref Vector4 v = ref Unsafe.Add(ref baseRef, i); @@ -30,7 +30,7 @@ public class UnPremultiplyVector4 { ref Vector4 baseRef = ref MemoryMarshal.GetReference(Vectors); - for (int i = 0; i < Vectors.Length; i++) + for (nint i = 0; i < (uint)Vectors.Length; i++) { ref Vector4 v = ref Unsafe.Add(ref baseRef, i); Numerics.UnPremultiply(ref v); diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo1x1.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo1x1.cs index f36f92e90..abdd6908d 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo1x1.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo1x1.cs @@ -72,8 +72,8 @@ public unsafe class Block8x8F_CopyTo1x1 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void CopyRowImpl(ref byte selfBase, ref byte destBase, int destStride, int row) { - ref byte s = ref Unsafe.Add(ref selfBase, row * 8 * sizeof(float)); - ref byte d = ref Unsafe.Add(ref destBase, row * destStride); + ref byte s = ref Unsafe.Add(ref selfBase, (uint)row * 8 * sizeof(float)); + ref byte d = ref Unsafe.Add(ref destBase, (uint)(row * destStride)); Unsafe.CopyBlock(ref d, ref s, 8 * sizeof(float)); } @@ -82,7 +82,7 @@ public unsafe class Block8x8F_CopyTo1x1 { ref Block8x8F s = ref this.block; ref float origin = ref Unsafe.AsRef(this.bufferPtr); - int stride = Width; + nint stride = (nint)(uint)Width; ref Vector d0 = ref Unsafe.As>(ref origin); ref Vector d1 = ref Unsafe.As>(ref Unsafe.Add(ref origin, stride)); @@ -117,7 +117,7 @@ public unsafe class Block8x8F_CopyTo1x1 { ref Block8x8F s = ref this.block; ref float origin = ref Unsafe.AsRef(this.bufferPtr); - int stride = Width; + nint stride = (nint)(uint)Width; ref Vector d0 = ref Unsafe.As>(ref origin); ref Vector d1 = ref Unsafe.As>(ref Unsafe.Add(ref origin, stride)); @@ -141,29 +141,29 @@ public unsafe class Block8x8F_CopyTo1x1 [Benchmark] public void UseVector8_V3() { - int stride = Width * sizeof(float); + nint stride = (nint)(uint)Width * sizeof(float); ref float d = ref this.unpinnedBuffer[0]; ref Vector s = ref Unsafe.As>(ref this.block); Vector v0 = s; - Vector v1 = Unsafe.AddByteOffset(ref s, (IntPtr)1); - Vector v2 = Unsafe.AddByteOffset(ref s, (IntPtr)2); - Vector v3 = Unsafe.AddByteOffset(ref s, (IntPtr)3); + Vector v1 = Unsafe.AddByteOffset(ref s, 1); + Vector v2 = Unsafe.AddByteOffset(ref s, 2); + Vector v3 = Unsafe.AddByteOffset(ref s, 3); Unsafe.As>(ref d) = v0; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)stride)) = v1; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 2))) = v2; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 3))) = v3; - - v0 = Unsafe.AddByteOffset(ref s, (IntPtr)4); - v1 = Unsafe.AddByteOffset(ref s, (IntPtr)5); - v2 = Unsafe.AddByteOffset(ref s, (IntPtr)6); - v3 = Unsafe.AddByteOffset(ref s, (IntPtr)7); - - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 4))) = v0; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 5))) = v1; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 6))) = v2; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 7))) = v3; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride)) = v1; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 2)) = v2; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 3)) = v3; + + v0 = Unsafe.AddByteOffset(ref s, 4); + v1 = Unsafe.AddByteOffset(ref s, 5); + v2 = Unsafe.AddByteOffset(ref s, 6); + v3 = Unsafe.AddByteOffset(ref s, 7); + + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 4)) = v0; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 5)) = v1; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 6)) = v2; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 7)) = v3; } [Benchmark] @@ -254,7 +254,7 @@ public unsafe class Block8x8F_CopyTo1x1 [Benchmark] public void UseVector256_Avx2_Variant3_RefCast() { - int stride = Width; + nint stride = (nint)(uint)Width; ref float d = ref this.unpinnedBuffer[0]; ref Vector256 s = ref Unsafe.As>(ref this.block); @@ -282,29 +282,29 @@ public unsafe class Block8x8F_CopyTo1x1 [Benchmark] public void UseVector256_Avx2_Variant3_RefCast_Mod() { - int stride = Width * sizeof(float); + nint stride = (nint)(uint)Width * sizeof(float); ref float d = ref this.unpinnedBuffer[0]; ref Vector256 s = ref Unsafe.As>(ref this.block); Vector256 v0 = s; - Vector256 v1 = Unsafe.AddByteOffset(ref s, (IntPtr)1); - Vector256 v2 = Unsafe.AddByteOffset(ref s, (IntPtr)2); - Vector256 v3 = Unsafe.AddByteOffset(ref s, (IntPtr)3); + Vector256 v1 = Unsafe.AddByteOffset(ref s, 1); + Vector256 v2 = Unsafe.AddByteOffset(ref s, 2); + Vector256 v3 = Unsafe.AddByteOffset(ref s, 3); Unsafe.As>(ref d) = v0; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)stride)) = v1; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 2))) = v2; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 3))) = v3; - - v0 = Unsafe.AddByteOffset(ref s, (IntPtr)4); - v1 = Unsafe.AddByteOffset(ref s, (IntPtr)5); - v2 = Unsafe.AddByteOffset(ref s, (IntPtr)6); - v3 = Unsafe.AddByteOffset(ref s, (IntPtr)7); - - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 4))) = v0; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 5))) = v1; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 6))) = v2; - Unsafe.As>(ref Unsafe.AddByteOffset(ref d, (IntPtr)(stride * 7))) = v3; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride)) = v1; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 2)) = v2; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 3)) = v3; + + v0 = Unsafe.AddByteOffset(ref s, 4); + v1 = Unsafe.AddByteOffset(ref s, 5); + v2 = Unsafe.AddByteOffset(ref s, 6); + v3 = Unsafe.AddByteOffset(ref s, 7); + + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 4)) = v0; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 5)) = v1; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 6)) = v2; + Unsafe.As>(ref Unsafe.AddByteOffset(ref d, stride * 7)) = v3; } // [Benchmark] diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs index 88c009823..72b6bb72e 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs @@ -47,9 +47,9 @@ public class Block8x8F_CopyTo2x2 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void WidenCopyImpl2x2(ref Block8x8F src, ref float destBase, int row, int destStride) { - ref Vector4 selfLeft = ref Unsafe.Add(ref src.V0L, 2 * row); + ref Vector4 selfLeft = ref Unsafe.Add(ref src.V0L, 2 * (uint)row); ref Vector4 selfRight = ref Unsafe.Add(ref selfLeft, 1); - ref float destLocalOrigo = ref Unsafe.Add(ref destBase, row * 2 * destStride); + ref float destLocalOrigo = ref Unsafe.Add(ref destBase, (uint)(row * 2 * destStride)); Unsafe.Add(ref destLocalOrigo, 0) = selfLeft.X; Unsafe.Add(ref destLocalOrigo, 1) = selfLeft.X; @@ -69,23 +69,23 @@ public class Block8x8F_CopyTo2x2 Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, 8), 6) = selfRight.W; Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, 8), 7) = selfRight.W; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride), 0) = selfLeft.X; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride), 1) = selfLeft.X; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride), 2) = selfLeft.Y; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride), 3) = selfLeft.Y; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride), 4) = selfLeft.Z; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride), 5) = selfLeft.Z; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride), 6) = selfLeft.W; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride), 7) = selfLeft.W; - - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride + 8), 0) = selfRight.X; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride + 8), 1) = selfRight.X; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride + 8), 2) = selfRight.Y; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride + 8), 3) = selfRight.Y; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride + 8), 4) = selfRight.Z; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride + 8), 5) = selfRight.Z; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride + 8), 6) = selfRight.W; - Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, destStride + 8), 7) = selfRight.W; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride), 0) = selfLeft.X; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride), 1) = selfLeft.X; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride), 2) = selfLeft.Y; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride), 3) = selfLeft.Y; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride), 4) = selfLeft.Z; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride), 5) = selfLeft.Z; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride), 6) = selfLeft.W; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride), 7) = selfLeft.W; + + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride + 8), 0) = selfRight.X; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride + 8), 1) = selfRight.X; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride + 8), 2) = selfRight.Y; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride + 8), 3) = selfRight.Y; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride + 8), 4) = selfRight.Z; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride + 8), 5) = selfRight.Z; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride + 8), 6) = selfRight.W; + Unsafe.Add(ref Unsafe.Add(ref destLocalOrigo, (uint)destStride + 8), 7) = selfRight.W; } [Benchmark] @@ -109,9 +109,9 @@ public class Block8x8F_CopyTo2x2 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void WidenCopyImpl2x2_V2(ref Block8x8F src, ref float destBase, int row, int destStride) { - ref Vector4 selfLeft = ref Unsafe.Add(ref src.V0L, 2 * row); + ref Vector4 selfLeft = ref Unsafe.Add(ref src.V0L, 2 * (uint)row); ref Vector4 selfRight = ref Unsafe.Add(ref selfLeft, 1); - ref float dest0 = ref Unsafe.Add(ref destBase, row * 2 * destStride); + ref float dest0 = ref Unsafe.Add(ref destBase, (uint)(row * 2 * destStride)); Unsafe.Add(ref dest0, 0) = selfLeft.X; Unsafe.Add(ref dest0, 1) = selfLeft.X; @@ -133,7 +133,7 @@ public class Block8x8F_CopyTo2x2 Unsafe.Add(ref dest1, 6) = selfRight.W; Unsafe.Add(ref dest1, 7) = selfRight.W; - ref float dest2 = ref Unsafe.Add(ref dest0, destStride); + ref float dest2 = ref Unsafe.Add(ref dest0, (uint)destStride); Unsafe.Add(ref dest2, 0) = selfLeft.X; Unsafe.Add(ref dest2, 1) = selfLeft.X; @@ -177,12 +177,12 @@ public class Block8x8F_CopyTo2x2 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void WidenCopyImpl2x2_Vector2(ref Block8x8F src, ref Vector2 destBase, int row, int destStride) { - ref Vector4 sLeft = ref Unsafe.Add(ref src.V0L, 2 * row); + ref Vector4 sLeft = ref Unsafe.Add(ref src.V0L, 2 * (uint)row); ref Vector4 sRight = ref Unsafe.Add(ref sLeft, 1); - ref Vector2 dTopLeft = ref Unsafe.Add(ref destBase, 2 * row * destStride); + ref Vector2 dTopLeft = ref Unsafe.Add(ref destBase, (uint)(2 * row * destStride)); ref Vector2 dTopRight = ref Unsafe.Add(ref dTopLeft, 4); - ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, destStride); + ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); ref Vector2 dBottomRight = ref Unsafe.Add(ref dBottomLeft, 4); var xLeft = new Vector2(sLeft.X); @@ -237,12 +237,12 @@ public class Block8x8F_CopyTo2x2 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void WidenCopyImpl2x2_Vector4(ref Block8x8F src, ref Vector2 destBase, int row, int destStride) { - ref Vector4 sLeft = ref Unsafe.Add(ref src.V0L, 2 * row); + ref Vector4 sLeft = ref Unsafe.Add(ref src.V0L, 2 * (uint)row); ref Vector4 sRight = ref Unsafe.Add(ref sLeft, 1); - ref Vector2 dTopLeft = ref Unsafe.Add(ref destBase, 2 * row * destStride); + ref Vector2 dTopLeft = ref Unsafe.Add(ref destBase, (uint)(2 * row * destStride)); ref Vector2 dTopRight = ref Unsafe.Add(ref dTopLeft, 4); - ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, destStride); + ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); ref Vector2 dBottomRight = ref Unsafe.Add(ref dBottomLeft, 4); var xLeft = new Vector4(sLeft.X); @@ -297,11 +297,11 @@ public class Block8x8F_CopyTo2x2 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void WidenCopyImpl2x2_Vector4_SafeRightCorner(ref Block8x8F src, ref Vector2 destBase, int row, int destStride) { - ref Vector4 sLeft = ref Unsafe.Add(ref src.V0L, 2 * row); + ref Vector4 sLeft = ref Unsafe.Add(ref src.V0L, 2 * (uint)row); ref Vector4 sRight = ref Unsafe.Add(ref sLeft, 1); - ref Vector2 dTopLeft = ref Unsafe.Add(ref destBase, 2 * row * destStride); - ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, destStride); + ref Vector2 dTopLeft = ref Unsafe.Add(ref destBase, (uint)(2 * row * destStride)); + ref Vector2 dBottomLeft = ref Unsafe.Add(ref dTopLeft, (uint)destStride); var xLeft = new Vector4(sLeft.X); var yLeft = new Vector4(sLeft.Y); @@ -355,12 +355,12 @@ public class Block8x8F_CopyTo2x2 [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void WidenCopyImpl2x2_Vector4_V2(ref Block8x8F src, ref Vector2 destBase, int row, int destStride) { - ref Vector4 sLeft = ref Unsafe.Add(ref src.V0L, 2 * row); + ref Vector4 sLeft = ref Unsafe.Add(ref src.V0L, 2 * (uint)row); ref Vector4 sRight = ref Unsafe.Add(ref sLeft, 1); int offset = 2 * row * destStride; - ref Vector4 dTopLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, offset)); - ref Vector4 dBottomLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, offset + destStride)); + ref Vector4 dTopLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, (uint)offset)); + ref Vector4 dBottomLeft = ref Unsafe.As(ref Unsafe.Add(ref destBase, (uint)(offset + destStride))); var xyLeft = new Vector4(sLeft.X) { diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_Round.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_Round.cs index afe9d94ae..2cc084885 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_Round.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_Round.cs @@ -54,7 +54,7 @@ public unsafe class Block8x8F_Round { ref float b = ref Unsafe.As(ref this.block); - for (int i = 0; i < Block8x8F.Size; i++) + for (nint i = 0; i < Block8x8F.Size; i++) { ref float v = ref Unsafe.Add(ref b, i); v = (float)Math.Round(v); @@ -178,7 +178,7 @@ public unsafe class Block8x8F_Round { ref Vector128 p = ref Unsafe.As>(ref this.block); p = Sse41.RoundToNearestInteger(p); - var offset = (IntPtr)sizeof(Vector128); + nint offset = sizeof(Vector128); p = Sse41.RoundToNearestInteger(p); p = ref Unsafe.AddByteOffset(ref p, offset); @@ -218,7 +218,7 @@ public unsafe class Block8x8F_Round { ref Vector128 p = ref Unsafe.As>(ref this.block); p = Sse41.RoundToNearestInteger(p); - var offset = (IntPtr)sizeof(Vector128); + nint offset = sizeof(Vector128); for (int i = 0; i < 15; i++) { @@ -231,7 +231,7 @@ public unsafe class Block8x8F_Round public unsafe void Sse41_V4() { ref Vector128 p = ref Unsafe.As>(ref this.block); - var offset = (IntPtr)sizeof(Vector128); + nint offset = sizeof(Vector128); ref Vector128 a = ref p; ref Vector128 b = ref Unsafe.AddByteOffset(ref a, offset); diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromRgba32.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromRgba32.cs index d418c45fe..29e03111b 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromRgba32.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromRgba32.cs @@ -34,7 +34,7 @@ public abstract class PixelConversion_ConvertFromRgba32 ref T destBaseRef = ref this.Dest[0]; ref Rgba32 sourceBaseRef = ref this.Source[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref destBaseRef, i).FromRgba32(ref Unsafe.Add(ref sourceBaseRef, i)); } @@ -48,7 +48,7 @@ public abstract class PixelConversion_ConvertFromRgba32 ref T destBaseRef = ref this.Dest[0]; ref Rgba32 sourceBaseRef = ref this.Source[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref destBaseRef, i).FromRgba32(Unsafe.Add(ref sourceBaseRef, i)); } @@ -62,7 +62,7 @@ public abstract class PixelConversion_ConvertFromRgba32 ref T destBaseRef = ref this.Dest[0]; ref Rgba32 sourceBaseRef = ref this.Source[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgba32 s = ref Unsafe.Add(ref sourceBaseRef, i); Unsafe.Add(ref destBaseRef, i).FromBytes(s.R, s.G, s.B, s.A); @@ -111,7 +111,7 @@ public class PixelConversion_ConvertFromRgba32_Compatible : PixelConversion_Conv ref Rgba32 sBase = ref this.CompatibleMemLayoutRunner.Source[0]; ref Rgba32 dBase = ref Unsafe.As(ref this.CompatibleMemLayoutRunner.Dest[0]); - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { Unsafe.Add(ref dBase, i) = Unsafe.Add(ref sBase, i); } @@ -151,7 +151,7 @@ public class PixelConversion_ConvertFromRgba32_Permuted_RgbaToArgb : PixelConver ref Rgba32 sBase = ref this.PermutedRunnerRgbaToArgb.Source[0]; ref TestArgb dBase = ref this.PermutedRunnerRgbaToArgb.Dest[0]; - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { Rgba32 s = Unsafe.Add(ref sBase, i); ref TestArgb d = ref Unsafe.Add(ref dBase, i); diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromVector4.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromVector4.cs index a167ade12..faf23efe0 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromVector4.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertFromVector4.cs @@ -71,7 +71,7 @@ public class PixelConversion_ConvertFromVector4 ref T destBaseRef = ref this.dest[0]; ref Vector4 sourceBaseRef = ref this.source[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref destBaseRef, i).FromVector4(ref Unsafe.Add(ref sourceBaseRef, i)); } @@ -85,7 +85,7 @@ public class PixelConversion_ConvertFromVector4 ref T destBaseRef = ref this.dest[0]; ref Vector4 sourceBaseRef = ref this.source[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref destBaseRef, i).FromVector4(Unsafe.Add(ref sourceBaseRef, i)); } diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32.cs index cd8307614..ef1ebdd42 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32.cs @@ -38,7 +38,7 @@ public class PixelConversion_ConvertToRgba32 ref T sourceBaseRef = ref this.source[0]; ref Rgba32 destBaseRef = ref this.dest[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref destBaseRef, i) = Unsafe.Add(ref sourceBaseRef, i).ToRgba32(); } @@ -52,7 +52,7 @@ public class PixelConversion_ConvertToRgba32 ref T sourceBaseRef = ref this.source[0]; ref Rgba32 destBaseRef = ref this.dest[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref sourceBaseRef, i).CopyToRgba32(ref Unsafe.Add(ref destBaseRef, i)); } diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation.cs index 9ea0c04c7..29412e6ed 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation.cs @@ -33,7 +33,7 @@ public class PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation Rgba32 temp; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { temp = Unsafe.Add(ref sourceBaseRef, i).ToRgba32(); @@ -54,7 +54,7 @@ public class PixelConversion_ConvertToRgba32_AsPartOfCompositeOperation Rgba32 temp = default; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref sourceBaseRef, i).CopyToRgba32(ref temp); diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4.cs index c03560e10..29e8b00b6 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4.cs @@ -30,7 +30,7 @@ public class PixelConversion_ConvertToVector4 ref T sourceBaseRef = ref this.source[0]; ref Vector4 destBaseRef = ref this.dest[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref destBaseRef, i) = Unsafe.Add(ref sourceBaseRef, i).ToVector4(); } @@ -44,7 +44,7 @@ public class PixelConversion_ConvertToVector4 ref T sourceBaseRef = ref this.source[0]; ref Vector4 destBaseRef = ref this.dest[0]; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref sourceBaseRef, i).CopyToVector4(ref Unsafe.Add(ref destBaseRef, i)); } diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4_AsPartOfCompositeOperation.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4_AsPartOfCompositeOperation.cs index 462bbbf7b..65b171734 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4_AsPartOfCompositeOperation.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_ConvertToVector4_AsPartOfCompositeOperation.cs @@ -32,7 +32,7 @@ public class PixelConversion_ConvertToVector4_AsPartOfCompositeOperation Vector4 temp; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { temp = Unsafe.Add(ref sourceBaseRef, i).ToVector4(); @@ -53,7 +53,7 @@ public class PixelConversion_ConvertToVector4_AsPartOfCompositeOperation Vector4 temp = default; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { Unsafe.Add(ref sourceBaseRef, i).CopyToVector4(ref temp); diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_PackFromRgbPlanes.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_PackFromRgbPlanes.cs index 061b1e126..5c9bfd763 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_PackFromRgbPlanes.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_PackFromRgbPlanes.cs @@ -92,7 +92,7 @@ public unsafe class PixelConversion_PackFromRgbPlanes ref byte b = ref this.rBuf[0]; ref Rgb24 rgb = ref this.rgbBuf[0]; - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { ref Rgb24 d = ref Unsafe.Add(ref rgb, i); d.R = Unsafe.Add(ref r, i); @@ -110,7 +110,7 @@ public unsafe class PixelConversion_PackFromRgbPlanes ref Rgb24 rgb = ref this.rgbBuf[0]; int count = this.Count / 8; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb24 d0 = ref Unsafe.Add(ref rgb, i * 8); ref Rgb24 d1 = ref Unsafe.Add(ref d0, 1); @@ -168,7 +168,7 @@ public unsafe class PixelConversion_PackFromRgbPlanes ref Rgb24 rgb = ref this.rgbBuf[0]; int count = this.Count / 4; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref Rgb24 d0 = ref Unsafe.Add(ref rgb, i * 4); ref Rgb24 d1 = ref Unsafe.Add(ref d0, 1); diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Argb32.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Argb32.cs index 9ae36cc8b..f1d08b9fb 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Argb32.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Argb32.cs @@ -31,7 +31,7 @@ public class PixelConversion_Rgba32_To_Argb32 ref Rgba32 sBase = ref this.source[0]; ref Argb32 dBase = ref this.dest[0]; - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { Rgba32 s = Unsafe.Add(ref sBase, i); Unsafe.Add(ref dBase, i).FromRgba32(s); @@ -45,7 +45,7 @@ public class PixelConversion_Rgba32_To_Argb32 ref Rgba32 sBase = ref MemoryMarshal.GetReference(source); ref TPixel dBase = ref MemoryMarshal.GetReference(dest); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { Rgba32 s = Unsafe.Add(ref sBase, i); Unsafe.Add(ref dBase, i).FromRgba32(s); @@ -64,7 +64,7 @@ public class PixelConversion_Rgba32_To_Argb32 ref Rgba32 sBase = ref this.source[0]; ref Argb32 dBase = ref this.dest[0]; - for (int i = 0; i < this.Count; i += 2) + for (nint i = 0; i < (uint)this.Count; i += 2) { ref Rgba32 s0 = ref Unsafe.Add(ref sBase, i); Rgba32 s1 = Unsafe.Add(ref s0, 1); @@ -81,7 +81,7 @@ public class PixelConversion_Rgba32_To_Argb32 ref Rgba32 sBase = ref this.source[0]; ref Argb32 dBase = ref this.dest[0]; - for (int i = 0; i < this.Count; i += 4) + for (nint i = 0; i < (uint)this.Count; i += 4) { ref Rgba32 s0 = ref Unsafe.Add(ref sBase, i); ref Rgba32 s1 = ref Unsafe.Add(ref s0, 1); @@ -105,7 +105,7 @@ public class PixelConversion_Rgba32_To_Argb32 ref uint sBase = ref Unsafe.As(ref this.source[0]); ref uint dBase = ref Unsafe.As(ref this.dest[0]); - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { uint s = Unsafe.Add(ref sBase, i); Unsafe.Add(ref dBase, i) = FromRgba32.ToArgb32(s); @@ -118,7 +118,7 @@ public class PixelConversion_Rgba32_To_Argb32 ref ulong sBase = ref Unsafe.As(ref this.source[0]); ref ulong dBase = ref Unsafe.As(ref this.dest[0]); - for (int i = 0; i < this.Count / 2; i++) + for (nint i = 0; i < (uint)this.Count / 2; i++) { ulong s = Unsafe.Add(ref sBase, i); uint lo = (uint)s; diff --git a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs index b7b939237..0da28c897 100644 --- a/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs +++ b/tests/ImageSharp.Benchmarks/General/PixelConversion/PixelConversion_Rgba32_To_Bgra32.cs @@ -52,7 +52,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref Rgba32 sBase = ref this.source[0]; ref Bgra32 dBase = ref this.dest[0]; - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { ref Rgba32 s = ref Unsafe.Add(ref sBase, i); Unsafe.Add(ref dBase, i).FromRgba32(s); @@ -66,7 +66,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref Rgba32 sBase = ref MemoryMarshal.GetReference(source); ref TPixel dBase = ref MemoryMarshal.GetReference(dest); - for (int i = 0; i < source.Length; i++) + for (nint i = 0; i < (uint)source.Length; i++) { ref Rgba32 s = ref Unsafe.Add(ref sBase, i); Unsafe.Add(ref dBase, i).FromRgba32(s); @@ -85,7 +85,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref Rgba32 sBase = ref this.source[0]; ref Bgra32 dBase = ref this.dest[0]; - for (int i = 0; i < this.Count; i += 2) + for (nint i = 0; i < (uint)this.Count; i += 2) { ref Rgba32 s0 = ref Unsafe.Add(ref sBase, i); Rgba32 s1 = Unsafe.Add(ref s0, 1); @@ -102,7 +102,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref Rgba32 sBase = ref this.source[0]; ref Bgra32 dBase = ref this.dest[0]; - for (int i = 0; i < this.Count; i += 4) + for (nint i = 0; i < (uint)this.Count; i += 4) { ref Rgba32 s0 = ref Unsafe.Add(ref sBase, i); ref Rgba32 s1 = ref Unsafe.Add(ref s0, 1); @@ -127,7 +127,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref Rgba32 sBase = ref MemoryMarshal.GetReference(source); ref TPixel dBase = ref MemoryMarshal.GetReference(dest); - for (int i = 0; i < source.Length; i += 4) + for (nint i = 0; i < (uint)source.Length; i += 4) { ref Rgba32 s0 = ref Unsafe.Add(ref sBase, i); ref Rgba32 s1 = ref Unsafe.Add(ref s0, 1); @@ -157,7 +157,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref Rgba32 sBase = ref this.source[0]; ref Bgra32 dBase = ref this.dest[0]; - for (int i = 0; i < this.Count / 4; i += 4) + for (nint i = 0; i < (uint)this.Count / 4; i += 4) { ref Rgba32 s0 = ref Unsafe.Add(ref sBase, i); ref Rgba32 s1 = ref Unsafe.Add(ref s0, 1); @@ -196,7 +196,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref uint sBase = ref Unsafe.As(ref this.source[0]); ref uint dBase = ref Unsafe.As(ref this.dest[0]); - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { uint s = Unsafe.Add(ref sBase, i); Unsafe.Add(ref dBase, i) = FromRgba32.ToBgra32(s); @@ -209,7 +209,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref Tuple4OfUInt32 sBase = ref Unsafe.As(ref this.source[0]); ref Tuple4OfUInt32 dBase = ref Unsafe.As(ref this.dest[0]); - for (int i = 0; i < this.Count / 4; i++) + for (nint i = 0; i < (uint)this.Count / 4; i++) { ref Tuple4OfUInt32 d = ref Unsafe.Add(ref dBase, i); d = Unsafe.Add(ref sBase, i); @@ -222,7 +222,7 @@ public class PixelConversion_Rgba32_To_Bgra32 { ref Tuple4OfUInt32 sBase = ref Unsafe.As(ref this.source[0]); - for (int i = 0; i < this.Count / 4; i++) + for (nint i = 0; i < (uint)this.Count / 4; i++) { Unsafe.Add(ref sBase, i).ConvertMe(); } @@ -234,7 +234,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref Octet sBase = ref Unsafe.As>(ref this.source[0]); ref Octet dBase = ref Unsafe.As>(ref this.dest[0]); - for (int i = 0; i < this.Count / 8; i++) + for (nint i = 0; i < (uint)this.Count / 8; i++) { BitopsSimdImpl(ref Unsafe.Add(ref sBase, i), ref Unsafe.Add(ref dBase, i)); } @@ -289,7 +289,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref uint sBase = ref Unsafe.As(ref this.source[0]); ref uint dBase = ref Unsafe.As(ref this.dest[0]); - for (int i = 0; i < this.Count; i++) + for (nint i = 0; i < (uint)this.Count; i++) { ref uint s0 = ref Unsafe.Add(ref sBase, i); uint s1 = Unsafe.Add(ref s0, 1); @@ -306,7 +306,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref ulong sBase = ref Unsafe.As(ref this.source[0]); ref ulong dBase = ref Unsafe.As(ref this.dest[0]); - for (int i = 0; i < this.Count / 2; i++) + for (nint i = 0; i < (uint)this.Count / 2; i++) { ulong s = Unsafe.Add(ref sBase, i); uint lo = (uint)s; @@ -326,7 +326,7 @@ public class PixelConversion_Rgba32_To_Bgra32 ref ulong sBase = ref Unsafe.As(ref this.source[0]); ref ulong dBase = ref Unsafe.As(ref this.dest[0]); - for (int i = 0; i < this.Count / 2; i++) + for (nint i = 0; i < (uint)this.Count / 2; i++) { ulong s = Unsafe.Add(ref sBase, i); uint lo = (uint)s; diff --git a/tests/ImageSharp.Benchmarks/General/Vectorization/WidenBytesToUInt32.cs b/tests/ImageSharp.Benchmarks/General/Vectorization/WidenBytesToUInt32.cs index 4615376a5..586618fcb 100644 --- a/tests/ImageSharp.Benchmarks/General/Vectorization/WidenBytesToUInt32.cs +++ b/tests/ImageSharp.Benchmarks/General/Vectorization/WidenBytesToUInt32.cs @@ -33,7 +33,7 @@ public class WidenBytesToUInt32 ref Octet sBase = ref Unsafe.As>(ref this.source[0]); ref Octet dBase = ref Unsafe.As>(ref this.dest[0]); - for (int i = 0; i < N; i++) + for (nint i = 0; i < N; i++) { Unsafe.Add(ref dBase, i).LoadFrom(ref Unsafe.Add(ref sBase, i)); } diff --git a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsSingleVector.cs b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsSingleVector.cs index fcf7e9dcc..33f5720aa 100644 --- a/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsSingleVector.cs +++ b/tests/ImageSharp.Benchmarks/PixelBlenders/PorterDuffBulkVsSingleVector.cs @@ -58,7 +58,7 @@ public class PorterDuffBulkVsSingleVector Vector256 result = default; Vector256 opacity = Vector256.Create(.5F); int count = this.backdrop.Length / 2; - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { result = PorterDuffFunctions.NormalSrcOver(Unsafe.Add(ref backdrop, i), Unsafe.Add(ref source, i), opacity); } diff --git a/tests/ImageSharp.Tests/Formats/Png/ReferenceImplementations.cs b/tests/ImageSharp.Tests/Formats/Png/ReferenceImplementations.cs index d57a77587..7610023af 100644 --- a/tests/ImageSharp.Tests/Formats/Png/ReferenceImplementations.cs +++ b/tests/ImageSharp.Tests/Formats/Png/ReferenceImplementations.cs @@ -34,8 +34,8 @@ internal static partial class ReferenceImplementations // Paeth(x) = Raw(x) - PaethPredictor(Raw(x-bpp), Prior(x), Prior(x - bpp)) resultBaseRef = 4; - int x = 0; - for (; x < bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) + nint x = 0; + for (; x < (nint)(uint)bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte above = Unsafe.Add(ref prevBaseRef, x); @@ -45,7 +45,7 @@ internal static partial class ReferenceImplementations sum += Numerics.Abs(unchecked((sbyte)res)); } - for (int xLeft = x - bytesPerPixel; x < scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x < (nint)(uint)scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte left = Unsafe.Add(ref scanBaseRef, xLeft); @@ -77,8 +77,8 @@ internal static partial class ReferenceImplementations // Sub(x) = Raw(x) - Raw(x-bpp) resultBaseRef = 1; - int x = 0; - for (; x < bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) + nint x = 0; + for (; x < (nint)(uint)bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); ++x; @@ -87,7 +87,7 @@ internal static partial class ReferenceImplementations sum += Numerics.Abs(unchecked((sbyte)res)); } - for (int xLeft = x - bytesPerPixel; x < scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x < (nint)(uint)scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte prev = Unsafe.Add(ref scanBaseRef, xLeft); @@ -119,9 +119,9 @@ internal static partial class ReferenceImplementations // Up(x) = Raw(x) - Prior(x) resultBaseRef = 2; - int x = 0; + nint x = 0; - for (; x < scanline.Length; /* Note: ++x happens in the body to avoid one add operation */) + for (; x < (nint)(uint)scanline.Length; /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte above = Unsafe.Add(ref prevBaseRef, x); @@ -154,8 +154,8 @@ internal static partial class ReferenceImplementations // Average(x) = Raw(x) - floor((Raw(x-bpp)+Prior(x))/2) resultBaseRef = 3; - int x = 0; - for (; x < bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) + nint x = 0; + for (; x < (nint)(uint)bytesPerPixel; /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte above = Unsafe.Add(ref prevBaseRef, x); @@ -165,7 +165,7 @@ internal static partial class ReferenceImplementations sum += Numerics.Abs(unchecked((sbyte)res)); } - for (int xLeft = x - bytesPerPixel; x < scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) + for (nint xLeft = x - (nint)(uint)bytesPerPixel; x < (nint)(uint)scanline.Length; ++xLeft /* Note: ++x happens in the body to avoid one add operation */) { byte scan = Unsafe.Add(ref scanBaseRef, x); byte left = Unsafe.Add(ref scanBaseRef, xLeft); diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelConverterTests.ReferenceImplementations.cs b/tests/ImageSharp.Tests/PixelFormats/PixelConverterTests.ReferenceImplementations.cs index 006cb9eb6..521270e3b 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelConverterTests.ReferenceImplementations.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelConverterTests.ReferenceImplementations.cs @@ -100,7 +100,7 @@ public abstract partial class PixelConverterTests if (typeof(TDestinationPixel) == typeof(L16)) { ref L16 l16Ref = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(destinationPixels)); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref TSourcePixel sp = ref Unsafe.Add(ref sourceRef, i); ref L16 dp = ref Unsafe.Add(ref l16Ref, i); @@ -113,7 +113,7 @@ public abstract partial class PixelConverterTests if (typeof(TDestinationPixel) == typeof(L8)) { ref L8 l8Ref = ref MemoryMarshal.GetReference(MemoryMarshal.Cast(destinationPixels)); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref TSourcePixel sp = ref Unsafe.Add(ref sourceRef, i); ref L8 dp = ref Unsafe.Add(ref l8Ref, i); @@ -125,7 +125,7 @@ public abstract partial class PixelConverterTests // Normal conversion ref TDestinationPixel destRef = ref MemoryMarshal.GetReference(destinationPixels); - for (int i = 0; i < count; i++) + for (nint i = 0; i < (uint)count; i++) { ref TSourcePixel sp = ref Unsafe.Add(ref sourceRef, i); ref TDestinationPixel dp = ref Unsafe.Add(ref destRef, i); diff --git a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs index a9b3ee9a4..73305183f 100644 --- a/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs +++ b/tests/ImageSharp.Tests/PixelFormats/PixelOperations/PixelOperationsTests.cs @@ -1184,7 +1184,7 @@ public abstract class PixelOperationsTests : MeasureFixture get { ref byte self = ref Unsafe.As(ref this); - return Unsafe.Add(ref self, idx); + return Unsafe.Add(ref self, (uint)idx); } } }