Browse Source

unwrap for-loop to avoid conditional check inside

it is known beforehand when the if condition inside the loop will not match: only in the last iteration.
Thus we can loop once less and append the last element afterwards.
af/merge-core
Peter Amrehn 7 years ago
committed by Unknown
parent
commit
a8812d7aa5
  1. 9
      src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs

9
src/ImageSharp/Formats/Jpeg/Components/Block8x8F.cs

@ -543,15 +543,14 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components
{
var sb = new StringBuilder();
sb.Append('[');
for (int i = 0; i < Size; i++)
for (int i = 0; i < Size - 1; i++)
{
sb.Append(this[i]);
if (i < Size - 1)
{
sb.Append(',');
}
sb.Append(',');
}
sb.Append(this[Size - 1]);
sb.Append(']');
return sb.ToString();
}

Loading…
Cancel
Save