Browse Source

Apply suggestions from code review

Co-authored-by: Günther Foidl <gue@korporal.at>
pull/1930/head
Brian Popow 4 years ago
committed by GitHub
parent
commit
d8db6539d5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/ImageSharp/Formats/Webp/AlphaDecoder.cs

10
src/ImageSharp/Formats/Webp/AlphaDecoder.cs

@ -314,14 +314,14 @@ namespace SixLabors.ImageSharp.Formats.Webp
#if SUPPORTS_RUNTIME_INTRINSICS
if (Sse2.IsSupported)
{
dst[0] = (byte)(input[0] + (prev == null ? 0 : prev[0]));
dst[0] = (byte)(input[0] + (prev.IsEmpty ? 0 : prev[0]));
if (width <= 1)
{
return;
}
int i;
var last = Vector128.Create(dst[0], 0, 0, 0);
nint i;
var last = Vector128<int>.Zero.WithElement(0, dst[0]);
ref byte srcRef = ref MemoryMarshal.GetReference(input);
for (i = 1; i + 8 <= width; i += 8)
{
@ -347,7 +347,7 @@ namespace SixLabors.ImageSharp.Formats.Webp
else
#endif
{
byte pred = (byte)(prev == null ? 0 : prev[0]);
byte pred = (byte)(prev.IsEmpty ? 0 : prev[0]);
for (int i = 0; i < width; i++)
{
@ -369,7 +369,7 @@ namespace SixLabors.ImageSharp.Formats.Webp
#if SUPPORTS_RUNTIME_INTRINSICS
if (Avx2.IsSupported)
{
int i;
nint i;
int maxPos = width & ~31;
for (i = 0; i < maxPos; i += 32)
{

Loading…
Cancel
Save