diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs index d55dfced72..f669a7ad9a 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs @@ -104,7 +104,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components { GuardBlockIndex(idx); ref float selfRef = ref Unsafe.As(ref this); - return Unsafe.Add(ref selfRef, idx); + return Unsafe.Add(ref selfRef, (nint)(uint)idx); } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -112,7 +112,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components { GuardBlockIndex(idx); ref float selfRef = ref Unsafe.As(ref this); - Unsafe.Add(ref selfRef, idx) = value; + Unsafe.Add(ref selfRef, (nint)(uint)idx) = value; } } diff --git a/src/ImageSharp/Formats/Jpeg/Components/Encoder/RgbForwardConverter{TPixel}.cs b/src/ImageSharp/Formats/Jpeg/Components/Encoder/RgbForwardConverter{TPixel}.cs index 7fad63e117..0be1076e22 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Encoder/RgbForwardConverter{TPixel}.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Encoder/RgbForwardConverter{TPixel}.cs @@ -103,7 +103,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Encoder for (int i = 0; i < Block8x8F.Size; i++) { - Rgb24 c = Unsafe.Add(ref rgbStart, i); + Rgb24 c = Unsafe.Add(ref rgbStart, (nint)(uint)i); redBlock[i] = c.R; greenBlock[i] = c.G; diff --git a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs index 3fd1a3c489..270a11ed6c 100644 --- a/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs +++ b/src/ImageSharp/Formats/Jpeg/JpegEncoderCore.cs @@ -167,14 +167,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg /// The color type. /// true, if color type is supported. private static bool IsSupportedColorType(JpegColorType? colorType) - { - if (colorType == JpegColorType.YCbCrRatio444 || colorType == JpegColorType.YCbCrRatio420 || colorType == JpegColorType.Luminance || colorType == JpegColorType.Rgb) - { - return true; - } - - return false; - } + => colorType == JpegColorType.YCbCrRatio444 + || colorType == JpegColorType.YCbCrRatio420 + || colorType == JpegColorType.Luminance + || colorType == JpegColorType.Rgb; /// /// Gets the component ids.