diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor{TPixel}.cs
index 2d8e21d6c..dd4cf873b 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/BlackIsZero1TiffColor{TPixel}.cs
@@ -19,21 +19,21 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
///
public override void Decode(ReadOnlySpan data, Buffer2D pixels, int left, int top, int width, int height)
{
- int offset = 0;
+ nint offset = 0;
var colorBlack = default(TPixel);
var colorWhite = default(TPixel);
colorBlack.FromRgba32(Color.Black);
colorWhite.FromRgba32(Color.White);
ref byte dataRef = ref MemoryMarshal.GetReference(data);
- for (int y = top; y < top + height; y++)
+ for (nint y = top; y < top + height; y++)
{
- Span pixelRowSpan = pixels.DangerousGetRowSpan(y);
+ Span pixelRowSpan = pixels.DangerousGetRowSpan((int)y);
ref TPixel pixelRowRef = ref MemoryMarshal.GetReference(pixelRowSpan);
- for (int x = left; x < left + width; x += 8)
+ for (nint x = left; x < left + width; x += 8)
{
byte b = Unsafe.Add(ref dataRef, offset++);
- int maxShift = Math.Min(left + width - x, 8);
+ nint maxShift = Math.Min(left + width - x, 8);
for (int shift = 0; shift < maxShift; shift++)
{
diff --git a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor{TPixel}.cs b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor{TPixel}.cs
index ad7d6c08a..ed8548d41 100644
--- a/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor{TPixel}.cs
+++ b/src/ImageSharp/Formats/Tiff/PhotometricInterpretation/WhiteIsZero1TiffColor{TPixel}.cs
@@ -18,21 +18,21 @@ namespace SixLabors.ImageSharp.Formats.Tiff.PhotometricInterpretation
///
public override void Decode(ReadOnlySpan data, Buffer2D pixels, int left, int top, int width, int height)
{
- int offset = 0;
+ nint offset = 0;
var colorBlack = default(TPixel);
var colorWhite = default(TPixel);
colorBlack.FromRgba32(Color.Black);
colorWhite.FromRgba32(Color.White);
ref byte dataRef = ref MemoryMarshal.GetReference(data);
- for (int y = top; y < top + height; y++)
+ for (nint y = top; y < top + height; y++)
{
- Span pixelRowSpan = pixels.DangerousGetRowSpan(y);
+ Span pixelRowSpan = pixels.DangerousGetRowSpan((int)y);
ref TPixel pixelRowRef = ref MemoryMarshal.GetReference(pixelRowSpan);
- for (int x = left; x < left + width; x += 8)
+ for (nint x = left; x < left + width; x += 8)
{
byte b = Unsafe.Add(ref dataRef, offset++);
- int maxShift = Math.Min(left + width - x, 8);
+ nint maxShift = Math.Min(left + width - x, 8);
for (int shift = 0; shift < maxShift; shift++)
{