diff --git a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.CieLab.cs
index 88343cbab4..54667ca2af 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 dcd6be185c..9949b5d91b 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 eb21394a09..4b856d1189 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 1b6735e623..2e8029f64a 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 2b34e66f2e..13b2a225c3 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 1495a28b64..2212ca2e58 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 068583e82f..ea9a5d734b 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 f40544b7a9..67ec162917 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 8bd014ed96..47ee42dc5a 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 2890594651..0604027760 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 897ec02a0f..fd385a15b0 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 291f3a5fac..56f61ef80b 100644
--- a/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs
+++ b/src/ImageSharp/ColorSpaces/Conversion/ColorSpaceConverter.Lms.cs
@@ -24,7 +24,7 @@ public partial class ColorSpaceConverter
ref CieLab sourceRef = ref MemoryMarshal.GetReference(source);
ref Lms destRef = ref MemoryMarshal.GetReference(destination);
- for (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 557c294992..080e1fc4bf 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 8ea875a3d7..da8e046ff7 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 55ed41220d..97e9cee813 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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/HexConverter.cs b/src/ImageSharp/Common/Helpers/HexConverter.cs
index 590b9d63c7..8c473688f3 100644
--- a/src/ImageSharp/Common/Helpers/HexConverter.cs
+++ b/src/ImageSharp/Common/Helpers/HexConverter.cs
@@ -16,12 +16,12 @@ internal static class HexConverter
/// The number of bytes written to .
public static int HexStringToBytes(ReadOnlySpan chars, Span bytes)
{
- if ((chars.Length & 1 /* bit-hack for % 2 */) != 0)
+ if (Numerics.Modulo2(chars.Length) != 0)
{
throw new ArgumentException("Input string length must be a multiple of 2", nameof(chars));
}
- if ((bytes.Length << 1 /* bit-hack for * 2 */) < chars.Length)
+ if ((bytes.Length << 1 /* bit-hack for *2 */) < chars.Length)
{
throw new ArgumentException("Output span must be at least half the length of the input string");
}
@@ -55,7 +55,7 @@ internal static class HexConverter
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // 255
};
- return c >= charToHexLookup.Length ? 0xFF : charToHexLookup[c];
+ return (uint)c >= (uint)charToHexLookup.Length ? 0xFF : charToHexLookup[c];
}
// See https://source.dot.net/#System.Private.CoreLib/HexConverter.cs,4681d45a0aa0b361
diff --git a/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs b/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs
index f2135b7645..a86355135e 100644
--- a/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs
+++ b/src/ImageSharp/Common/Helpers/Shuffle/IComponentShuffle.cs
@@ -61,14 +61,14 @@ internal readonly struct DefaultShuffle4 : IShuffle4
ref byte sBase = ref MemoryMarshal.GetReference(source);
ref byte dBase = ref MemoryMarshal.GetReference(dest);
- Shuffle.InverseMMShuffle(this.Control, out int p3, out int p2, out int p1, out int p0);
+ Shuffle.InverseMMShuffle(this.Control, out uint p3, out uint p2, out uint p1, out uint p0);
- for (nint i = 0; i < (uint)source.Length; i += 4)
+ for (nuint i = 0; i < (uint)source.Length; i += 4)
{
- 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);
+ Unsafe.Add(ref dBase, i + 0) = 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);
}
}
}
@@ -86,7 +86,7 @@ internal readonly struct WXYZShuffle4 : IShuffle4
ref uint dBase = ref Unsafe.As(ref MemoryMarshal.GetReference(dest));
int n = (int)((uint)source.Length / 4);
- for (nint i = 0; i < (uint)n; i++)
+ for (nuint 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 = (int)((uint)source.Length / 4);
- for (nint i = 0; i < (uint)n; i++)
+ for (nuint 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 = (int)((uint)source.Length / 4);
- for (nint i = 0; i < (uint)n; i++)
+ for (nuint 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 = (int)((uint)source.Length / 4);
- for (nint i = 0; i < (uint)n; i++)
+ for (nuint 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 = (int)((uint)source.Length / 4);
- for (nint i = 0; i < (uint)n; i++)
+ for (nuint 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 3e1084d313..6cf6eef08e 100644
--- a/src/ImageSharp/Common/Helpers/Shuffle/IPad3Shuffle4.cs
+++ b/src/ImageSharp/Common/Helpers/Shuffle/IPad3Shuffle4.cs
@@ -29,21 +29,21 @@ internal readonly struct DefaultPad3Shuffle4 : IPad3Shuffle4
ref byte sBase = ref MemoryMarshal.GetReference(source);
ref byte dBase = ref MemoryMarshal.GetReference(dest);
- Shuffle.InverseMMShuffle(this.Control, out int p3, out int p2, out int p1, out int p0);
+ Shuffle.InverseMMShuffle(this.Control, out uint p3, out uint p2, out uint p1, out uint p0);
Span temp = stackalloc byte[4];
ref byte t = ref MemoryMarshal.GetReference(temp);
ref uint tu = ref Unsafe.As(ref t);
- for (nint i = 0, j = 0; i < (uint)source.Length; i += 3, j += 4)
+ for (nuint 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 + 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);
+ Unsafe.Add(ref dBase, j + 0) = 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);
}
}
}
diff --git a/src/ImageSharp/Common/Helpers/Shuffle/IShuffle3.cs b/src/ImageSharp/Common/Helpers/Shuffle/IShuffle3.cs
index b149bde09d..2cd586212e 100644
--- a/src/ImageSharp/Common/Helpers/Shuffle/IShuffle3.cs
+++ b/src/ImageSharp/Common/Helpers/Shuffle/IShuffle3.cs
@@ -29,13 +29,13 @@ internal readonly struct DefaultShuffle3 : IShuffle3
ref byte sBase = ref MemoryMarshal.GetReference(source);
ref byte dBase = ref MemoryMarshal.GetReference(dest);
- Shuffle.InverseMMShuffle(this.Control, out _, out int p2, out int p1, out int p0);
+ Shuffle.InverseMMShuffle(this.Control, out _, out uint p2, out uint p1, out uint p0);
- for (nint i = 0; i < (uint)source.Length; i += 3)
+ for (nuint i = 0; i < (uint)source.Length; i += 3)
{
- 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 + 0) = 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);
}
}
}
diff --git a/src/ImageSharp/Common/Helpers/Shuffle/IShuffle4Slice3.cs b/src/ImageSharp/Common/Helpers/Shuffle/IShuffle4Slice3.cs
index 1f12cea257..5e82973e33 100644
--- a/src/ImageSharp/Common/Helpers/Shuffle/IShuffle4Slice3.cs
+++ b/src/ImageSharp/Common/Helpers/Shuffle/IShuffle4Slice3.cs
@@ -29,13 +29,13 @@ internal readonly struct DefaultShuffle4Slice3 : IShuffle4Slice3
ref byte sBase = ref MemoryMarshal.GetReference(source);
ref byte dBase = ref MemoryMarshal.GetReference(dest);
- Shuffle.InverseMMShuffle(this.Control, out _, out int p2, out int p1, out int p0);
+ Shuffle.InverseMMShuffle(this.Control, out _, out uint p2, out uint p1, out uint p0);
- for (nint i = 0, j = 0; i < (uint)dest.Length; i += 3, j += 4)
+ for (nuint i = 0, j = 0; i < (uint)dest.Length; i += 3, j += 4)
{
- 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);
+ Unsafe.Add(ref dBase, i + 0) = 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);
}
}
}
diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.ExtendedIntrinsics.cs b/src/ImageSharp/Common/Helpers/SimdUtils.ExtendedIntrinsics.cs
index 9d2da7dc83..43998d0ec9 100644
--- a/src/ImageSharp/Common/Helpers/SimdUtils.ExtendedIntrinsics.cs
+++ b/src/ImageSharp/Common/Helpers/SimdUtils.ExtendedIntrinsics.cs
@@ -97,12 +97,12 @@ internal static partial class SimdUtils
{
VerifySpanInput(source, dest, Vector.Count);
- nint n = (nint)(uint)dest.Length / Vector.Count;
+ nuint n = (uint)(dest.Length / Vector.Count);
ref Vector sourceBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(source));
ref Vector destBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(dest));
- for (nint i = 0; i < n; i++)
+ for (nuint i = 0; i < n; i++)
{
Vector b = Unsafe.Add(ref sourceBase, i);
@@ -132,13 +132,13 @@ internal static partial class SimdUtils
{
VerifySpanInput(source, dest, Vector.Count);
- nint n = (nint)(uint)dest.Length / Vector.Count;
+ nuint n = (uint)(dest.Length / Vector.Count);
ref Vector sourceBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(source));
ref Vector destBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(dest));
- for (nint i = 0; i < n; i++)
+ for (nuint i = 0; i < n; i++)
{
ref Vector s = ref Unsafe.Add(ref sourceBase, i * 4);
diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.FallbackIntrinsics128.cs b/src/ImageSharp/Common/Helpers/SimdUtils.FallbackIntrinsics128.cs
index 6fc36cd701..d456d8e42f 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 (nint i = 0; i < (uint)count; i++)
+ for (nuint 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 06b61443f3..5f83ccd6be 100644
--- a/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs
+++ b/src/ImageSharp/Common/Helpers/SimdUtils.HwIntrinsics.cs
@@ -221,7 +221,7 @@ internal static partial class SimdUtils
ref Vector256 destBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(dest));
- nint n = (nint)(uint)dest.Length / Vector256.Count;
+ nint n = (nint)(uint)(dest.Length / Vector256.Count);
nint m = Numerics.Modulo4(n);
nint u = n - m;
@@ -391,9 +391,9 @@ internal static partial class SimdUtils
ref Vector128 destBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(dest));
- nint n = (nint)(uint)source.Length / Vector128.Count;
+ nuint n = (uint)(source.Length / Vector128.Count);
- for (nint i = 0; i < n; i += 3)
+ for (nuint i = 0; i < n; i += 3)
{
ref Vector128 vs = ref Unsafe.Add(ref sourceBase, i);
@@ -454,9 +454,9 @@ internal static partial class SimdUtils
ref Vector128 destBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(dest));
- nint n = (nint)(uint)source.Length / Vector128.Count;
+ nuint n = (uint)(source.Length / Vector128.Count);
- for (nint i = 0, j = 0; i < n; i += 3, j += 4)
+ for (nuint i = 0, j = 0; i < n; i += 3, j += 4)
{
ref Vector128 v0 = ref Unsafe.Add(ref sourceBase, i);
Vector128 v1 = Unsafe.Add(ref v0, 1);
@@ -498,9 +498,9 @@ internal static partial class SimdUtils
ref Vector128 destBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(dest));
- nint n = (nint)(uint)source.Length / Vector128.Count;
+ nuint n = (uint)(source.Length / Vector128.Count);
- for (nint i = 0, j = 0; i < n; i += 4, j += 3)
+ for (nuint i = 0, j = 0; i < n; i += 4, j += 3)
{
ref Vector128 vs = ref Unsafe.Add(ref sourceBase, i);
@@ -650,16 +650,16 @@ internal static partial class SimdUtils
{
VerifySpanInput(source, dest, Vector256.Count);
- nint n = (nint)(uint)dest.Length / Vector256.Count;
+ nuint n = (uint)(dest.Length / Vector256.Count);
ref Vector256 destBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(dest));
var scale = Vector256.Create(1 / (float)byte.MaxValue);
- for (nint i = 0; i < n; i++)
+ for (nuint i = 0; i < n; i++)
{
- nint si = Vector256.Count * i;
+ nuint si = (uint)Vector256.Count * i;
Vector256 i0 = Avx2.ConvertToVector256Int32(sourceBase + si);
Vector256 i1 = Avx2.ConvertToVector256Int32(sourceBase + si + Vector256.Count);
Vector256 i2 = Avx2.ConvertToVector256Int32(sourceBase + si + (Vector256.Count * 2));
@@ -683,7 +683,7 @@ internal static partial class SimdUtils
// Sse
VerifySpanInput(source, dest, Vector128.Count);
- nint n = (nint)(uint)dest.Length / Vector128.Count;
+ nuint n = (uint)(dest.Length / Vector128.Count);
ref Vector128 destBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(dest));
@@ -691,9 +691,9 @@ internal static partial class SimdUtils
var scale = Vector128.Create(1 / (float)byte.MaxValue);
Vector128 zero = Vector128.Zero;
- for (nint i = 0; i < n; i++)
+ for (nuint i = 0; i < n; i++)
{
- nint si = Vector128.Count * i;
+ nuint si = (uint)Vector128.Count * i;
Vector128 i0, i1, i2, i3;
if (Sse41.IsSupported)
@@ -782,7 +782,7 @@ internal static partial class SimdUtils
{
VerifySpanInput(source, dest, Vector256.Count);
- nint n = (nint)(uint)dest.Length / Vector256.Count;
+ nuint n = (uint)(dest.Length / Vector256.Count);
ref Vector256 sourceBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(source));
@@ -794,7 +794,7 @@ internal static partial class SimdUtils
ref byte maskBase = ref MemoryMarshal.GetReference(PermuteMaskDeinterleave8x32);
Vector256 mask = Unsafe.As>(ref maskBase);
- for (nint i = 0; i < n; i++)
+ for (nuint i = 0; i < n; i++)
{
ref Vector256 s = ref Unsafe.Add(ref sourceBase, i * 4);
@@ -821,7 +821,7 @@ internal static partial class SimdUtils
// Sse
VerifySpanInput(source, dest, Vector128.Count);
- nint n = (nint)(uint)dest.Length / Vector128.Count;
+ nuint n = (uint)(dest.Length / Vector128.Count);
ref Vector128 sourceBase =
ref Unsafe.As>(ref MemoryMarshal.GetReference(source));
@@ -831,7 +831,7 @@ internal static partial class SimdUtils
var scale = Vector128.Create((float)byte.MaxValue);
- for (nint i = 0; i < n; i++)
+ for (nuint i = 0; i < n; i++)
{
ref Vector128 s = ref Unsafe.Add(ref sourceBase, i * 4);
@@ -864,7 +864,7 @@ internal static partial class SimdUtils
ref Vector256 bBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(blueChannel));
ref byte dBase = ref Unsafe.As(ref MemoryMarshal.GetReference(destination));
- nint count = (nint)(uint)redChannel.Length / Vector256.Count;
+ nuint count = (uint)(redChannel.Length / Vector256.Count);
ref byte control1Bytes = ref MemoryMarshal.GetReference(PermuteMaskEvenOdd8x32);
Vector256 control1 = Unsafe.As>(ref control1Bytes);
@@ -875,7 +875,7 @@ internal static partial class SimdUtils
Vector256 shuffleAlpha = Unsafe.As>(ref MemoryMarshal.GetReference(ShuffleMaskShiftAlpha));
- for (nint i = 0; i < count; i++)
+ for (nuint i = 0; i < count; i++)
{
Vector256 r0 = Unsafe.Add(ref rBase, i);
Vector256 g0 = Unsafe.Add(ref gBase, i);
@@ -936,12 +936,12 @@ internal static partial class SimdUtils
ref Vector256 bBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(blueChannel));
ref Vector256 dBase = ref Unsafe.As>(ref MemoryMarshal.GetReference(destination));
- nint count = (nint)(uint)redChannel.Length / Vector256.Count;
+ nuint count = (uint)(redChannel.Length / Vector256.Count);
ref byte control1Bytes = ref MemoryMarshal.GetReference(PermuteMaskEvenOdd8x32);
Vector256 control1 = Unsafe.As>(ref control1Bytes);
var a = Vector256.Create((byte)255);
- for (nint i = 0; i < count; i++)
+ for (nuint i = 0; i < count; i++)
{
Vector256 r0 = Unsafe.Add(ref rBase, i);
Vector256 g0 = Unsafe.Add(ref gBase, i);
@@ -994,8 +994,8 @@ internal static partial class SimdUtils
Vector256 r, g, b;
const int bytesPerRgbStride = 24;
- int count = (int)((uint)source.Length / 8);
- for (nint i = 0; i < (uint)count; i++)
+ nuint count = (uint)source.Length / 8;
+ for (nuint i = 0; i < count; i++)
{
rgb = Avx2.PermuteVar8x32(Unsafe.AddByteOffset(ref rgbByteSpan, (uint)(bytesPerRgbStride * i)).AsUInt32(), extractToLanesMask).AsByte();
@@ -1013,7 +1013,7 @@ internal static partial class SimdUtils
Unsafe.Add(ref destBRef, i) = b;
}
- int sliceCount = count * 8;
+ int sliceCount = (int)(count * 8);
redChannel = redChannel.Slice(sliceCount);
greenChannel = greenChannel.Slice(sliceCount);
blueChannel = blueChannel.Slice(sliceCount);
diff --git a/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs b/src/ImageSharp/Common/Helpers/SimdUtils.Pack.cs
index ff8323df03..f471d0231b 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);
- uint count = (uint)redChannel.Length / 4;
- for (nint i = 0; i < count; i++)
+ nuint count = (uint)redChannel.Length / 4;
+ for (nuint i = 0; i < count; i++)
{
ref Rgb24 d0 = ref Unsafe.Add(ref rgb, i * 4);
ref Rgb24 d1 = ref Unsafe.Add(ref d0, 1);
@@ -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);
- uint count = (uint)redChannel.Length / 4;
+ nuint count = (uint)redChannel.Length / 4;
destination.Fill(new Rgba32(0, 0, 0, 255));
- for (nint i = 0; i < count; i++)
+ for (nuint i = 0; i < count; i++)
{
ref Rgba32 d0 = ref Unsafe.Add(ref rgb, i * 4);
ref Rgba32 d1 = ref Unsafe.Add(ref d0, 1);
@@ -181,7 +181,7 @@ internal static partial class SimdUtils
ref byte b = ref MemoryMarshal.GetReference(blueChannel);
ref Rgb24 rgb = ref MemoryMarshal.GetReference(destination);
- for (nint i = 0; i < (uint)destination.Length; i++)
+ for (nuint 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 (nint i = 0; i < (uint)destination.Length; i++)
+ for (nuint 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 (nint i = 0; i < (uint)source.Length; i++)
+ for (nuint 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 532f9d4fab..c1437c05e6 100644
--- a/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs
+++ b/src/ImageSharp/Common/Helpers/SimdUtils.Shuffle.cs
@@ -145,14 +145,14 @@ internal static partial class SimdUtils
{
ref float sBase = ref MemoryMarshal.GetReference(source);
ref float dBase = ref MemoryMarshal.GetReference(dest);
- Shuffle.InverseMMShuffle(control, out int p3, out int p2, out int p1, out int p0);
+ Shuffle.InverseMMShuffle(control, out uint p3, out uint p2, out uint p1, out uint p0);
- for (nint i = 0; i < (uint)source.Length; i += 4)
+ for (nuint i = 0; i < (uint)source.Length; i += 4)
{
- 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);
+ Unsafe.Add(ref dBase, i + 0) = 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);
}
}
@@ -492,34 +492,34 @@ internal static partial class SimdUtils
{
InverseMMShuffle(
control,
- out int p3,
- out int p2,
- out int p1,
- out int p0);
+ out uint p3,
+ out uint p2,
+ out uint p1,
+ out uint p0);
ref byte spanBase = ref MemoryMarshal.GetReference(span);
- for (int i = 0; i < span.Length; i += 4)
+ for (nuint i = 0; i < (uint)span.Length; i += 4)
{
- 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);
+ Unsafe.Add(ref spanBase, i + 0) = (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);
}
}
[MethodImpl(InliningOptions.ShortMethod)]
public static void InverseMMShuffle(
byte control,
- out int p3,
- out int p2,
- out int p1,
- out int p0)
+ out uint p3,
+ out uint p2,
+ out uint p1,
+ out uint p0)
{
- p3 = (control >> 6) & 0x3;
- p2 = (control >> 4) & 0x3;
- p1 = (control >> 2) & 0x3;
- p0 = (control >> 0) & 0x3;
+ p3 = (uint)((control >> 6) & 0x3);
+ p2 = (uint)((control >> 4) & 0x3);
+ p1 = (uint)((control >> 2) & 0x3);
+ p0 = (uint)((control >> 0) & 0x3);
}
}
}
diff --git a/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs b/src/ImageSharp/Compression/Zlib/DeflaterHuffman.cs
index ebc43f8822..e4dc1945a8 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 (nint i = 0; i < LiteralNumber; i++)
+ for (nuint i = 0; i < LiteralNumber; i++)
{
static_len += this.literalTree.Frequencies[i] * Unsafe.Add(ref staticLLengthRef, i);
}
ref byte staticDLengthRef = ref MemoryMarshal.GetReference(StaticDLength);
- for (nint i = 0; i < DistanceNumber; i++)
+ for (nuint i = 0; i < DistanceNumber; i++)
{
static_len += this.distTree.Frequencies[i] * Unsafe.Add(ref staticDLengthRef, i);
}
@@ -625,10 +625,10 @@ internal sealed unsafe class DeflaterHuffman : IDisposable
ref int valuesRef = ref MemoryMarshal.GetReference(valuesMemoryOwner.Memory.Span);
int numNodes = numLeafs;
- for (nint i = 0; i < (uint)heapLen; i++)
+ for (nuint i = 0; i < (uint)heapLen; i++)
{
int node = Unsafe.Add(ref heapRef, i);
- nint i2 = 2 * i;
+ nuint 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;
diff --git a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
index a2c7058233..60f18c8023 100644
--- a/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
+++ b/src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
@@ -123,8 +123,8 @@ internal sealed class BmpEncoderCore : IImageEncoderInternals
BmpMetadata bmpMetadata = metadata.GetBmpMetadata();
this.bitsPerPixel ??= bmpMetadata.BitsPerPixel;
- short bpp = (short)this.bitsPerPixel;
- int bytesPerLine = (int)(4 * ((((uint)image.Width * (ushort)bpp) + 31) / 32));
+ ushort bpp = (ushort)this.bitsPerPixel;
+ int bytesPerLine = (int)(4 * ((((uint)image.Width * bpp) + 31) / 32));
this.padding = bytesPerLine - (int)(image.Width * (bpp / 8F));
int colorPaletteSize = this.bitsPerPixel switch
@@ -176,7 +176,7 @@ internal sealed class BmpEncoderCore : IImageEncoderInternals
/// The metadata.
/// The icc profile data.
/// The bitmap information header.
- private BmpInfoHeader CreateBmpInfoHeader(int width, int height, int infoHeaderSize, short bpp, int bytesPerLine, ImageMetadata metadata, byte[]? iccProfileData)
+ private BmpInfoHeader CreateBmpInfoHeader(int width, int height, int infoHeaderSize, ushort bpp, int bytesPerLine, ImageMetadata metadata, byte[]? iccProfileData)
{
int hResolution = 0;
int vResolution = 0;
@@ -212,7 +212,7 @@ internal sealed class BmpEncoderCore : IImageEncoderInternals
width: width,
height: height,
planes: 1,
- bitsPerPixel: bpp,
+ bitsPerPixel: (short)bpp,
imageSize: height * bytesPerLine,
xPelsPerMeter: hResolution,
yPelsPerMeter: vResolution,
diff --git a/src/ImageSharp/Formats/ImageExtensions.Save.tt b/src/ImageSharp/Formats/ImageExtensions.Save.tt
index 7498aa7c3b..64f3bde9cc 100644
--- a/src/ImageSharp/Formats/ImageExtensions.Save.tt
+++ b/src/ImageSharp/Formats/ImageExtensions.Save.tt
@@ -77,7 +77,7 @@ public static partial class ImageExtensions
public static void SaveAs<#= fmt #>(this Image source, string path, <#= fmt #>Encoder encoder) =>
source.Save(
path,
- encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(<#= fmt #>Format.Instance));
+ encoder ?? source.GetConfiguration().ImageFormatsManager.GetEncoder(<#= fmt #>Format.Instance));
///
/// Saves the image to the given stream with the <#= fmt #> format.
@@ -91,7 +91,7 @@ public static partial class ImageExtensions
public static Task SaveAs<#= fmt #>Async(this Image source, string path, <#= fmt #>Encoder encoder, CancellationToken cancellationToken = default)
=> source.SaveAsync(
path,
- encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(<#= fmt #>Format.Instance),
+ encoder ?? source.GetConfiguration().ImageFormatsManager.GetEncoder(<#= fmt #>Format.Instance),
cancellationToken);
///
@@ -124,7 +124,7 @@ public static partial class ImageExtensions
public static void SaveAs<#= fmt #>(this Image source, Stream stream, <#= fmt #>Encoder encoder)
=> source.Save(
stream,
- encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(<#= fmt #>Format.Instance));
+ encoder ?? source.GetConfiguration().ImageFormatsManager.GetEncoder(<#= fmt #>Format.Instance));
///
/// Saves the image to the given stream with the <#= fmt #> format.
@@ -138,7 +138,7 @@ public static partial class ImageExtensions
public static Task SaveAs<#= fmt #>Async(this Image source, Stream stream, <#= fmt #>Encoder encoder, CancellationToken cancellationToken = default)
=> source.SaveAsync(
stream,
- encoder ?? source.GetConfiguration().ImageFormatsManager.FindEncoder(<#= fmt #>Format.Instance),
+ encoder ?? source.GetConfiguration().ImageFormatsManager.GetEncoder(<#= fmt #>Format.Instance),
cancellationToken);
<#
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs
index e5d252f432..93bb7be36e 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.cs
@@ -16,7 +16,7 @@ internal partial struct Block8x8F
{
var CMin4 = new Vector4(0F);
var CMax4 = new Vector4(maximum);
- var COff4 = new Vector4(MathF.Ceiling(maximum * 0.5F)); // /2
+ var COff4 = new Vector4(MathF.Ceiling(maximum * 0.5F));
this.V0L = Numerics.Clamp(this.V0L + COff4, CMin4, CMax4);
this.V0R = Numerics.Clamp(this.V0R + COff4, CMin4, CMax4);
@@ -42,7 +42,7 @@ internal partial struct Block8x8F
[MethodImpl(InliningOptions.ShortMethod)]
public void NormalizeColorsAndRoundInPlaceVector8(float maximum)
{
- var off = new Vector(MathF.Ceiling(maximum * 0.5F)); // /2
+ var off = new Vector(MathF.Ceiling(maximum * 0.5F));
var max = new Vector(maximum);
ref Vector row0 = ref Unsafe.As>(ref this.V0L);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt
index 7350edd38b..19b795c23a 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt
+++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Generated.tt
@@ -29,7 +29,7 @@ internal partial struct Block8x8F
{
var CMin4 = new Vector4(0F);
var CMax4 = new Vector4(maximum);
- var COff4 = new Vector4(MathF.Ceiling(maximum * 0.5F)); // /2
+ var COff4 = new Vector4(MathF.Ceiling(maximum * 0.5F));
<#
@@ -53,7 +53,7 @@ internal partial struct Block8x8F
[MethodImpl(InliningOptions.ShortMethod)]
public void NormalizeColorsAndRoundInPlaceVector8(float maximum)
{
- var off = new Vector(MathF.Ceiling(maximum * 0.5F)); // /2
+ var off = new Vector(MathF.Ceiling(maximum * 0.5F));
var max = new Vector(maximum);
<#
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Intrinsic.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Intrinsic.cs
index 7611d403ac..63be76f00f 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Intrinsic.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.Intrinsic.cs
@@ -41,9 +41,9 @@ internal partial struct Block8x8F
ref Vector256 bBase = ref b.V0;
ref Vector256 destRef = ref dest.V01;
- var multiplyIntoInt16ShuffleMask = Vector256.Create(0, 1, 4, 5, 2, 3, 6, 7);
+ Vector256 multiplyIntoInt16ShuffleMask = Vector256.Create(0, 1, 4, 5, 2, 3, 6, 7);
- for (nint i = 0; i < 8; i += 2)
+ for (nuint i = 0; i < 8; i += 2)
{
Vector256 row0 = Avx.ConvertToVector256Int32(Avx.Multiply(Unsafe.Add(ref aBase, i + 0), Unsafe.Add(ref bBase, i + 0)));
Vector256 row1 = Avx.ConvertToVector256Int32(Avx.Multiply(Unsafe.Add(ref aBase, i + 1), Unsafe.Add(ref bBase, i + 1)));
@@ -64,7 +64,7 @@ internal partial struct Block8x8F
ref Vector128 destBase = ref Unsafe.As>(ref dest);
- for (nint i = 0; i < 16; i += 2)
+ for (nuint 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)));
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs
index e68ede9fbb..652c064ad5 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopy.cs
@@ -30,13 +30,13 @@ internal partial struct Block8x8F
}
// TODO: Optimize: implement all cases with scale-specific, loopless code!
- this.CopyArbitraryScale(ref areaOrigin, areaStride, horizontalScale, verticalScale);
+ this.CopyArbitraryScale(ref areaOrigin, (uint)areaStride, (uint)horizontalScale, (uint)verticalScale);
}
private void CopyTo2x2Scale(ref float areaOrigin, int areaStride)
{
ref Vector2 destBase = ref Unsafe.As(ref areaOrigin);
- int destStride = (int)((uint)areaStride / 2);
+ nuint destStride = (uint)areaStride / 2;
WidenCopyRowImpl2x2(ref this.V0L, ref destBase, 0, destStride);
WidenCopyRowImpl2x2(ref this.V0L, ref destBase, 1, destStride);
@@ -48,12 +48,12 @@ internal partial struct Block8x8F
WidenCopyRowImpl2x2(ref this.V0L, ref destBase, 7, destStride);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- static void WidenCopyRowImpl2x2(ref Vector4 selfBase, ref Vector2 destBase, nint row, nint destStride)
+ static void WidenCopyRowImpl2x2(ref Vector4 selfBase, ref Vector2 destBase, nuint row, nuint destStride)
{
ref Vector4 sLeft = ref Unsafe.Add(ref selfBase, 2 * row);
ref Vector4 sRight = ref Unsafe.Add(ref sLeft, 1);
- nint offset = 2 * row * destStride;
+ nuint 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));
@@ -86,23 +86,23 @@ internal partial struct Block8x8F
}
[MethodImpl(InliningOptions.ColdPath)]
- private void CopyArbitraryScale(ref float areaOrigin, int areaStride, int horizontalScale, int verticalScale)
+ private void CopyArbitraryScale(ref float areaOrigin, uint areaStride, uint horizontalScale, uint verticalScale)
{
- for (int y = 0; y < 8; y++)
+ for (nuint y = 0; y < 8; y++)
{
- int yy = y * verticalScale;
- int y8 = y * 8;
+ nuint yy = y * verticalScale;
+ nuint y8 = y * 8;
- for (int x = 0; x < 8; x++)
+ for (nuint x = 0; x < 8; x++)
{
- int xx = x * horizontalScale;
+ nuint xx = x * horizontalScale;
- float value = this[y8 + x];
- nint baseIdx = (nint)(uint)((yy * areaStride) + xx);
+ float value = this[(int)(y8 + x)];
+ nuint baseIdx = (uint)((yy * areaStride) + xx);
- for (nint i = 0; i < verticalScale; i++, baseIdx += areaStride)
+ for (nuint i = 0; i < verticalScale; i++, baseIdx += areaStride)
{
- for (nint j = 0; j < (uint)horizontalScale; j++)
+ for (nuint j = 0; j < horizontalScale; j++)
{
// area[xx + j, yy + i] = value;
Unsafe.Add(ref areaOrigin, baseIdx + j) = value;
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs
index a0a8cd28e2..21971a8c7d 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs
@@ -71,28 +71,34 @@ internal partial struct Block8x8F : IEquatable
/// The index
/// The float value at the specified index
public float this[int idx]
+ {
+ get => this[(uint)idx];
+ set => this[(uint)idx] = value;
+ }
+
+ internal float this[nuint idx]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
- DebugGuard.MustBeBetweenOrEqualTo(idx, 0, Size - 1, nameof(idx));
+ DebugGuard.MustBeBetweenOrEqualTo((int)idx, 0, Size - 1, nameof(idx));
ref float selfRef = ref Unsafe.As(ref this);
- return Unsafe.Add(ref selfRef, (nint)(uint)idx);
+ return Unsafe.Add(ref selfRef, idx);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
set
{
- DebugGuard.MustBeBetweenOrEqualTo(idx, 0, Size - 1, nameof(idx));
+ DebugGuard.MustBeBetweenOrEqualTo((int)idx, 0, Size - 1, nameof(idx));
ref float selfRef = ref Unsafe.As(ref this);
- Unsafe.Add(ref selfRef, (nint)(uint)idx) = value;
+ Unsafe.Add(ref selfRef, idx) = value;
}
}
public float this[int x, int y]
{
- get => this[(y * 8) + x];
- set => this[(y * 8) + x] = value;
+ get => this[((uint)y * 8) + (uint)x];
+ set => this[((uint)y * 8) + (uint)x] = value;
}
public static Block8x8F Load(Span data)
@@ -425,7 +431,7 @@ internal partial struct Block8x8F : IEquatable
Vector256 targetVector = Vector256.Create(value);
ref Vector256 blockStride = ref this.V0;
- for (nint i = 0; i < RowCount; i++)
+ for (nuint i = 0; i < RowCount; i++)
{
Vector256 areEqual = Avx2.CompareEqual(Avx.ConvertToVector256Int32WithTruncation(Unsafe.Add(ref this.V0, i)), targetVector);
if (Avx2.MoveMask(areEqual.AsByte()) != equalityMask)
@@ -439,7 +445,7 @@ internal partial struct Block8x8F : IEquatable
ref float scalars = ref Unsafe.As(ref this);
- for (nint i = 0; i < Size; i++)
+ for (nuint i = 0; i < Size; i++)
{
if ((int)Unsafe.Add(ref scalars, i) != value)
{
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.CmykAvx.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.CmykAvx.cs
index 3144afa76b..07ba3648c4 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.CmykAvx.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.CmykAvx.cs
@@ -32,8 +32,8 @@ internal abstract partial class JpegColorConverterBase
// Used for the color conversion
var scale = Vector256.Create(1 / (this.MaximumValue * this.MaximumValue));
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
ref Vector256 c = ref Unsafe.Add(ref c0Base, i);
ref Vector256 m = ref Unsafe.Add(ref c1Base, i);
@@ -71,8 +71,8 @@ internal abstract partial class JpegColorConverterBase
var scale = Vector256.Create(maxValue);
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
Vector256 ctmp = Avx.Subtract(scale, Unsafe.Add(ref srcR, i));
Vector256 mtmp = Avx.Subtract(scale, Unsafe.Add(ref srcG, i));
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.CmykVector.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.CmykVector.cs
index 03d9a1532a..2e2ff08bf9 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.CmykVector.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.CmykVector.cs
@@ -30,8 +30,8 @@ internal abstract partial class JpegColorConverterBase
var scale = new Vector(1 / (this.MaximumValue * this.MaximumValue));
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
ref Vector c = ref Unsafe.Add(ref cBase, i);
ref Vector m = ref Unsafe.Add(ref mBase, i);
@@ -78,8 +78,8 @@ internal abstract partial class JpegColorConverterBase
// Used for the color conversion
var scale = new Vector(maxValue);
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
Vector ctmp = scale - Unsafe.Add(ref srcR, i);
Vector mtmp = scale - Unsafe.Add(ref srcG, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleAvx.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleAvx.cs
index 4bb9869728..80ae6621c4 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleAvx.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleAvx.cs
@@ -27,8 +27,8 @@ internal abstract partial class JpegColorConverterBase
// Used for the color conversion
var scale = Vector256.Create(1 / this.MaximumValue);
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
ref Vector256 c0 = ref Unsafe.Add(ref c0Base, i);
c0 = Avx.Multiply(c0, scale);
@@ -53,8 +53,8 @@ internal abstract partial class JpegColorConverterBase
var f0587 = Vector256.Create(0.587f);
var f0114 = Vector256.Create(0.114f);
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
ref Vector256 r = ref Unsafe.Add(ref srcRed, i);
ref Vector256 g = ref Unsafe.Add(ref srcGreen, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleScalar.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleScalar.cs
index df511594af..4d3b5c60bd 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 < (uint)values.Length; i++)
+ for (nuint i = 0; i < (uint)values.Length; i++)
{
Unsafe.Add(ref valuesRef, i) *= scale;
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleVector.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleVector.cs
index d8ba115d24..018e0ca442 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleVector.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.GrayScaleVector.cs
@@ -24,8 +24,8 @@ internal abstract partial class JpegColorConverterBase
var scale = new Vector(1 / this.MaximumValue);
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
ref Vector c0 = ref Unsafe.Add(ref cBase, i);
c0 *= scale;
@@ -53,8 +53,8 @@ internal abstract partial class JpegColorConverterBase
var gMult = new Vector(0.587f);
var bMult = new Vector(0.114f);
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
Vector r = Unsafe.Add(ref srcR, i);
Vector g = Unsafe.Add(ref srcR, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbArm.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbArm.cs
index 4a2112592f..72d8340a0f 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbArm.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbArm.cs
@@ -30,8 +30,8 @@ internal abstract partial class JpegColorConverterBase
// Used for the color conversion
var scale = Vector128.Create(1 / this.MaximumValue);
- nint n = (nint)(uint)values.Component0.Length / Vector128.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector128.Count);
+ for (nuint i = 0; i < n; i++)
{
ref Vector128 r = ref Unsafe.Add(ref rBase, i);
ref Vector128 g = ref Unsafe.Add(ref gBase, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbAvx.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbAvx.cs
index 76b2e9936c..8c095309c7 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbAvx.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbAvx.cs
@@ -29,8 +29,8 @@ internal abstract partial class JpegColorConverterBase
// Used for the color conversion
var scale = Vector256.Create(1 / this.MaximumValue);
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
ref Vector256 r = ref Unsafe.Add(ref rBase, i);
ref Vector256 g = ref Unsafe.Add(ref gBase, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbVector.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbVector.cs
index 5d85bb0482..cbba796440 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbVector.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.RgbVector.cs
@@ -28,8 +28,8 @@ internal abstract partial class JpegColorConverterBase
var scale = new Vector(1 / this.MaximumValue);
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
ref Vector r = ref Unsafe.Add(ref rBase, i);
ref Vector g = ref Unsafe.Add(ref gBase, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrAvx.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrAvx.cs
index 59f24493a1..e828ba1179 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrAvx.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrAvx.cs
@@ -38,8 +38,8 @@ internal abstract partial class JpegColorConverterBase
var bCbMult = Vector256.Create(YCbCrScalar.BCbMult);
// Walking 8 elements at one step:
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
// y = yVals[i];
// cb = cbVals[i] - 128F;
@@ -98,8 +98,8 @@ internal abstract partial class JpegColorConverterBase
var fn0081312F = Vector256.Create(-0.081312F);
var f05 = Vector256.Create(0.5f);
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
Vector256 r = Unsafe.Add(ref srcR, i);
Vector256 g = Unsafe.Add(ref srcG, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrVector.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrVector.cs
index 0f7a364868..e3b4be235f 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrVector.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YCbCrVector.cs
@@ -35,8 +35,8 @@ internal abstract partial class JpegColorConverterBase
var gCrMult = new Vector(-YCbCrScalar.GCrMult);
var bCbMult = new Vector(YCbCrScalar.BCbMult);
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
// y = yVals[i];
// cb = cbVals[i] - 128F;
@@ -103,8 +103,8 @@ internal abstract partial class JpegColorConverterBase
var gCrMult = new Vector(0.418688f);
var bCrMult = new Vector(0.081312f);
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
Vector r = Unsafe.Add(ref srcR, i);
Vector g = Unsafe.Add(ref srcG, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKAvx.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKAvx.cs
index 0cfb3201b4..8ab2dd3d67 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKAvx.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKAvx.cs
@@ -40,8 +40,8 @@ internal abstract partial class JpegColorConverterBase
var bCbMult = Vector256.Create(YCbCrScalar.BCbMult);
// Walking 8 elements at one step:
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
// y = yVals[i];
// cb = cbVals[i] - 128F;
@@ -109,8 +109,8 @@ internal abstract partial class JpegColorConverterBase
var fn0081312F = Vector256.Create(-0.081312F);
var f05 = Vector256.Create(0.5f);
- nint n = (nint)(uint)values.Component0.Length / Vector256.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector256.Count);
+ for (nuint i = 0; i < n; i++)
{
Vector256 r = Avx.Subtract(maxSampleValue, Unsafe.Add(ref srcR, i));
Vector256 g = Avx.Subtract(maxSampleValue, Unsafe.Add(ref srcG, i));
diff --git a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKVector.cs b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKVector.cs
index feefe3021d..711b0fe3bb 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKVector.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/ColorConverters/JpegColorConverter.YccKVector.cs
@@ -36,8 +36,8 @@ internal abstract partial class JpegColorConverterBase
var gCrMult = new Vector(-YCbCrScalar.GCrMult);
var bCbMult = new Vector(YCbCrScalar.BCbMult);
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
// y = yVals[i];
// cb = cbVals[i] - 128F;
@@ -107,8 +107,8 @@ internal abstract partial class JpegColorConverterBase
var gCrMult = new Vector(0.418688f);
var bCrMult = new Vector(0.081312f);
- nint n = (nint)(uint)values.Component0.Length / Vector.Count;
- for (nint i = 0; i < n; i++)
+ nuint n = (uint)(values.Component0.Length / Vector.Count);
+ for (nuint i = 0; i < n; i++)
{
Vector r = maxSampleValue - Unsafe.Add(ref srcR, i);
Vector g = maxSampleValue - Unsafe.Add(ref srcG, i);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs
index fcefe542d4..5ecf779615 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ArithmeticScanDecoder.cs
@@ -470,7 +470,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder
this.DecodeBlockBaseline(
component,
- ref Unsafe.Add(ref blockRef, (nint)(uint)blockCol),
+ ref Unsafe.Add(ref blockRef, (uint)blockCol),
ref acDecodingTable,
ref dcDecodingTable);
}
@@ -521,7 +521,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder
this.DecodeBlockBaseline(
component,
- ref Unsafe.Add(ref blockRef, (nint)(uint)k),
+ ref Unsafe.Add(ref blockRef, (uint)k),
ref acDecodingTable,
ref dcDecodingTable);
@@ -560,7 +560,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder
this.DecodeBlockBaseline(
component,
- ref Unsafe.Add(ref blockRef, (nint)(uint)i),
+ ref Unsafe.Add(ref blockRef, (uint)i),
ref acDecodingTable,
ref dcDecodingTable);
@@ -611,7 +611,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder
this.DecodeBlockProgressiveDc(
component,
- ref Unsafe.Add(ref blockRef, (nint)(uint)blockCol),
+ ref Unsafe.Add(ref blockRef, (uint)blockCol),
ref dcDecodingTable);
}
}
@@ -653,7 +653,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder
this.DecodeBlockProgressiveDc(
component,
- ref Unsafe.Add(ref blockRef, (nint)(uint)i),
+ ref Unsafe.Add(ref blockRef, (uint)i),
ref dcDecodingTable);
this.HandleRestart();
@@ -680,7 +680,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder
this.DecodeBlockProgressiveAc(
component,
- ref Unsafe.Add(ref blockRef, (nint)(uint)i),
+ ref Unsafe.Add(ref blockRef, (uint)i),
ref acDecodingTable);
this.HandleRestart();
@@ -717,7 +717,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder
// Figure F.21: Decoding nonzero value v.
// Figure F.22: Decoding the sign of v.
int sign = this.DecodeBinaryDecision(ref reader, ref Unsafe.Add(ref st, 1));
- st = ref Unsafe.Add(ref st, (nint)(uint)(2 + sign));
+ st = ref Unsafe.Add(ref st, (uint)(2 + sign));
// Figure F.23: Decoding the magnitude category of v.
int m = this.DecodeBinaryDecision(ref reader, ref st);
@@ -967,7 +967,7 @@ internal class ArithmeticScanDecoder : IJpegScanDecoder
// Figure F.21: Decoding nonzero value v
// Figure F.22: Decoding the sign of v
int sign = this.DecodeBinaryDecision(ref reader, ref Unsafe.Add(ref st, 1));
- st = ref Unsafe.Add(ref st, (nint)(uint)(2 + sign));
+ st = ref Unsafe.Add(ref st, (uint)(2 + sign));
// Figure F.23: Decoding the magnitude category of v.
int m = this.DecodeBinaryDecision(ref reader, ref st);
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor2.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor2.cs
index 8b4256e3b9..0ec7500e0d 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor2.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor2.cs
@@ -67,30 +67,30 @@ internal sealed class DownScalingComponentProcessor2 : ComponentProcessor
public static void ScaledCopyTo(ref Block8x8F block, ref float destRef, int destStrideWidth, int horizontalScale, int verticalScale)
{
// TODO: Optimize: implement all cases with scale-specific, loopless code!
- CopyArbitraryScale(ref block, ref destRef, destStrideWidth, horizontalScale, verticalScale);
+ CopyArbitraryScale(ref block, ref destRef, (uint)destStrideWidth, (uint)horizontalScale, (uint)verticalScale);
[MethodImpl(InliningOptions.ColdPath)]
- static void CopyArbitraryScale(ref Block8x8F block, ref float areaOrigin, int areaStride, int horizontalScale, int verticalScale)
+ static void CopyArbitraryScale(ref Block8x8F block, ref float areaOrigin, uint areaStride, uint horizontalScale, uint verticalScale)
{
- for (int y = 0; y < 4; y++)
+ for (nuint y = 0; y < 4; y++)
{
- int yy = y * verticalScale;
- int y8 = y * 8;
+ nuint yy = y * verticalScale;
+ nuint y8 = y * 8;
- for (int x = 0; x < 4; x++)
+ for (nuint x = 0; x < 4; x++)
{
- int xx = x * horizontalScale;
+ nuint xx = x * horizontalScale;
float value = block[y8 + x];
- for (int i = 0; i < verticalScale; i++)
+ for (nuint i = 0; i < verticalScale; i++)
{
- int baseIdx = ((yy + i) * areaStride) + xx;
+ nuint baseIdx = ((yy + i) * areaStride) + xx;
- for (int j = 0; j < horizontalScale; j++)
+ for (nuint j = 0; j < horizontalScale; j++)
{
// area[xx + j, yy + i] = value;
- Unsafe.Add(ref areaOrigin, (nint)(uint)(baseIdx + j)) = value;
+ Unsafe.Add(ref areaOrigin, baseIdx + j) = value;
}
}
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor4.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor4.cs
index 170cdbb3c8..99daaa49e7 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor4.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor4.cs
@@ -67,30 +67,30 @@ internal sealed class DownScalingComponentProcessor4 : ComponentProcessor
public static void ScaledCopyTo(ref Block8x8F block, ref float destRef, int destStrideWidth, int horizontalScale, int verticalScale)
{
// TODO: Optimize: implement all cases with scale-specific, loopless code!
- CopyArbitraryScale(ref block, ref destRef, destStrideWidth, horizontalScale, verticalScale);
+ CopyArbitraryScale(ref block, ref destRef, (uint)destStrideWidth, (uint)horizontalScale, (uint)verticalScale);
[MethodImpl(InliningOptions.ColdPath)]
- static void CopyArbitraryScale(ref Block8x8F block, ref float areaOrigin, int areaStride, int horizontalScale, int verticalScale)
+ static void CopyArbitraryScale(ref Block8x8F block, ref float areaOrigin, uint areaStride, uint horizontalScale, uint verticalScale)
{
- for (int y = 0; y < 2; y++)
+ for (nuint y = 0; y < 2; y++)
{
- int yy = y * verticalScale;
- int y8 = y * 8;
+ nuint yy = y * verticalScale;
+ nuint y8 = y * 8;
- for (int x = 0; x < 2; x++)
+ for (nuint x = 0; x < 2; x++)
{
- int xx = x * horizontalScale;
+ nuint xx = x * horizontalScale;
float value = block[y8 + x];
- for (int i = 0; i < verticalScale; i++)
+ for (nuint i = 0; i < verticalScale; i++)
{
- int baseIdx = ((yy + i) * areaStride) + xx;
+ nuint baseIdx = ((yy + i) * areaStride) + xx;
- for (int j = 0; j < horizontalScale; j++)
+ for (nuint j = 0; j < horizontalScale; j++)
{
// area[xx + j, yy + i] = value;
- Unsafe.Add(ref areaOrigin, (nint)(uint)(baseIdx + j)) = value;
+ Unsafe.Add(ref areaOrigin, baseIdx + j) = value;
}
}
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor8.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor8.cs
index 81104d2f3d..cf321d7cd9 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor8.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/DownScalingComponentProcessor8.cs
@@ -67,20 +67,20 @@ internal sealed class DownScalingComponentProcessor8 : ComponentProcessor
{
destRef = value;
Unsafe.Add(ref destRef, 1) = value;
- Unsafe.Add(ref destRef, 0 + (nint)(uint)destStrideWidth) = value;
- Unsafe.Add(ref destRef, 1 + (nint)(uint)destStrideWidth) = value;
+ Unsafe.Add(ref destRef, 0 + (uint)destStrideWidth) = value;
+ Unsafe.Add(ref destRef, 1 + (uint)destStrideWidth) = value;
return;
}
// TODO: Optimize: implement all cases with scale-specific, loopless code!
- for (int y = 0; y < verticalScale; y++)
+ for (nuint y = 0; y < (uint)verticalScale; y++)
{
- for (int x = 0; x < horizontalScale; x++)
+ for (nuint x = 0; x < (uint)horizontalScale; x++)
{
- Unsafe.Add(ref destRef, (nint)(uint)x) = value;
+ Unsafe.Add(ref destRef, x) = value;
}
- destRef = ref Unsafe.Add(ref destRef, (nint)(uint)destStrideWidth);
+ destRef = ref Unsafe.Add(ref destRef, (uint)destStrideWidth);
}
}
}
diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs
index 3c89ab1fb6..9b08175051 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs
@@ -122,8 +122,8 @@ internal class ComponentProcessor : IDisposable
ref Vector256 sourceVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(source));
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
- nint count = (nint)(uint)source.Length / Vector256.Count;
- for (nint i = 0; i < count; i++)
+ nuint count = (uint)(source.Length / Vector256.Count);
+ for (nuint i = 0; i < count; i++)
{
Unsafe.Add(ref targetVectorRef, i) = Avx.Add(Unsafe.Add(ref targetVectorRef, i), Unsafe.Add(ref sourceVectorRef, i));
}
@@ -133,15 +133,15 @@ internal class ComponentProcessor : IDisposable
ref Vector targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target));
ref Vector sourceVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(source));
- nint count = (nint)(uint)source.Length / Vector.Count;
- for (nint i = 0; i < count; i++)
+ nuint count = (uint)(source.Length / Vector.Count);
+ for (nuint i = 0; i < count; i++)
{
Unsafe.Add(ref targetVectorRef, i) += Unsafe.Add(ref sourceVectorRef, i);
}
ref float targetRef = ref MemoryMarshal.GetReference(target);
ref float sourceRef = ref MemoryMarshal.GetReference(source);
- for (nint i = count * Vector.Count; i < (uint)source.Length; i++)
+ for (nuint i = count * (uint)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);
- nint length = (nint)(uint)touchedCount / Vector256.Count;
+ nuint length = (uint)(touchedCount / Vector256.Count);
for (int i = 0; i < haddIterationsCount; i++)
{
length /= 2;
- for (nint j = 0; j < length; j++)
+ for (nuint j = 0; j < length; j++)
{
- nint indexLeft = j * 2;
- nint indexRight = indexLeft + 1;
+ nuint indexLeft = j * 2;
+ nuint 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();
}
@@ -200,9 +200,9 @@ internal class ComponentProcessor : IDisposable
ref Vector256 targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target));
// Spans are guaranteed to be multiple of 8 so no extra 'remainder' steps are needed
- nint count = (nint)(uint)target.Length / Vector256.Count;
+ nuint count = (uint)(target.Length / Vector256.Count);
var multiplierVector = Vector256.Create(multiplier);
- for (nint i = 0; i < count; i++)
+ for (nuint i = 0; i < count; i++)
{
Unsafe.Add(ref targetVectorRef, i) = Avx.Multiply(Unsafe.Add(ref targetVectorRef, i), multiplierVector);
}
@@ -211,15 +211,15 @@ internal class ComponentProcessor : IDisposable
{
ref Vector targetVectorRef = ref Unsafe.As>(ref MemoryMarshal.GetReference(target));
- nint count = (nint)(uint)target.Length / Vector.Count;
+ nuint count = (uint)(target.Length / Vector.Count);
var multiplierVector = new Vector(multiplier);
- for (nint i = 0; i < count; i++)
+ for (nuint i = 0; i < count; i++)
{
Unsafe.Add(ref targetVectorRef, i) *= multiplierVector;
}
ref float targetRef = ref MemoryMarshal.GetReference(target);
- for (nint i = count * Vector.Count; i < (uint)target.Length; i++)
+ for (nuint i = count * (uint)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 1453b0a568..d74494f9e5 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 < (uint)w; k++)
+ for (nuint 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 < (uint)w; k++)
+ for (nuint k = 0; k < (uint)w; k++)
{
this.WriteBlock(
component,
@@ -246,9 +246,9 @@ internal class HuffmanScanEncoder
private void EncodeScanBaselineInterleaved(JpegFrame frame, SpectralConverter converter, CancellationToken cancellationToken)
where TPixel : unmanaged, IPixel
{
- nint mcu = 0;
- nint mcusPerColumn = frame.McusPerColumn;
- nint mcusPerLine = frame.McusPerLine;
+ int mcu = 0;
+ int mcusPerColumn = frame.McusPerColumn;
+ int mcusPerLine = frame.McusPerLine;
for (int j = 0; j < mcusPerColumn; j++)
{
@@ -258,21 +258,21 @@ internal class HuffmanScanEncoder
converter.ConvertStrideBaseline();
// Encode spectral to binary
- for (nint i = 0; i < mcusPerLine; i++)
+ for (int i = 0; i < mcusPerLine; i++)
{
// Scan an interleaved mcu... process components in order
- nint mcuCol = mcu % mcusPerLine;
- for (nint k = 0; k < frame.Components.Length; k++)
+ int mcuCol = mcu % mcusPerLine;
+ for (int k = 0; k < frame.Components.Length; k++)
{
Component component = frame.Components[k];
ref HuffmanLut dcHuffmanTable = ref this.dcHuffmanTables[component.DcTableId];
ref HuffmanLut acHuffmanTable = ref this.acHuffmanTables[component.AcTableId];
- nint h = component.HorizontalSamplingFactor;
+ int h = component.HorizontalSamplingFactor;
int v = component.VerticalSamplingFactor;
- nint blockColBase = mcuCol * h;
+ nuint blockColBase = (uint)(mcuCol * h);
// Scan out an mcu's worth of this component; that's just determined
// by the basic H and V specified for the component
@@ -281,9 +281,9 @@ internal class HuffmanScanEncoder
Span blockSpan = component.SpectralBlocks.DangerousGetRowSpan(y);
ref Block8x8 blockRef = ref MemoryMarshal.GetReference(blockSpan);
- for (nint x = 0; x < h; x++)
+ for (nuint x = 0; x < (uint)h; x++)
{
- nint blockCol = blockColBase + x;
+ nuint blockCol = blockColBase + x;
this.WriteBlock(
component,
@@ -315,8 +315,8 @@ internal class HuffmanScanEncoder
private void EncodeThreeComponentBaselineInterleavedScanNoSubsampling(JpegFrame frame, SpectralConverter converter, CancellationToken cancellationToken)
where TPixel : unmanaged, IPixel
{
- nint mcusPerColumn = frame.McusPerColumn;
- nint mcusPerLine = frame.McusPerLine;
+ nuint mcusPerColumn = (uint)frame.McusPerColumn;
+ nuint mcusPerLine = (uint)frame.McusPerLine;
Component c2 = frame.Components[2];
Component c1 = frame.Components[1];
@@ -333,7 +333,7 @@ internal class HuffmanScanEncoder
ref Block8x8 c1BlockRef = ref MemoryMarshal.GetReference(c1.SpectralBlocks.DangerousGetRowSpan(y: 0));
ref Block8x8 c2BlockRef = ref MemoryMarshal.GetReference(c2.SpectralBlocks.DangerousGetRowSpan(y: 0));
- for (nint j = 0; j < mcusPerColumn; j++)
+ for (nuint j = 0; j < mcusPerColumn; j++)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -341,7 +341,7 @@ internal class HuffmanScanEncoder
converter.ConvertStrideBaseline();
// Encode spectral to binary
- for (nint i = 0; i < mcusPerLine; i++)
+ for (nuint i = 0; i < mcusPerLine; i++)
{
this.WriteBlock(
c0,
diff --git a/src/ImageSharp/Formats/Jpeg/Components/FloatingPointDCT.cs b/src/ImageSharp/Formats/Jpeg/Components/FloatingPointDCT.cs
index 15348d4474..0aca33b4c9 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/FloatingPointDCT.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/FloatingPointDCT.cs
@@ -69,7 +69,7 @@ internal static partial class FloatingPointDCT
{
ref float tableRef = ref Unsafe.As