Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ImageSharp/Formats/Png/Zlib/Adler32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static uint Calculate(uint adler, ReadOnlySpan<byte> buffer)
{
if (buffer.IsEmpty)
{
return SeedValue;
return adler;
}

#if SUPPORTS_RUNTIME_INTRINSICS
Expand Down
2 changes: 1 addition & 1 deletion src/ImageSharp/Formats/Png/Zlib/Crc32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static uint Calculate(uint crc, ReadOnlySpan<byte> buffer)
{
if (buffer.IsEmpty)
{
return SeedValue;
return crc;
}

#if SUPPORTS_RUNTIME_INTRINSICS
Expand Down
9 changes: 9 additions & 0 deletions tests/ImageSharp.Tests/Formats/Png/Adler32Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
{
public class Adler32Tests
{
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
public void ReturnsCorrectWhenEmpty(uint input)
{
Assert.Equal(input, Adler32.Calculate(input, default));
}

[Theory]
[InlineData(0)]
[InlineData(8)]
Expand Down
9 changes: 9 additions & 0 deletions tests/ImageSharp.Tests/Formats/Png/Crc32Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png
{
public class Crc32Tests
{
[Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
public void ReturnsCorrectWhenEmpty(uint input)
{
Assert.Equal(input, Crc32.Calculate(input, default));
}

[Theory]
[InlineData(0)]
[InlineData(8)]
Expand Down