Browse Source

Simplify Memset: Use Span.Fill

pull/1871/head
Brian Popow 5 years ago
parent
commit
15c28e1495
  1. 9
      src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs

9
src/ImageSharp/Formats/Webp/Lossy/LossyUtils.cs

@ -2295,14 +2295,7 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossy
}
[MethodImpl(InliningOptions.ShortMethod)]
private static void Memset(Span<byte> dst, byte value, int startIdx, int count)
{
int end = startIdx + count;
for (int i = startIdx; i < end; i++)
{
dst[i] = value;
}
}
private static void Memset(Span<byte> dst, byte value, int startIdx, int count) => dst.Slice(startIdx, count).Fill(value);
[MethodImpl(InliningOptions.ShortMethod)]
private static int Clamp255(int x) => x < 0 ? 0 : x > 255 ? 255 : x;

Loading…
Cancel
Save