Browse Source

avoid doubled increment in for loop and multiple array indexer access

af/merge-core
Peter Amrehn 7 years ago
committed by Unknown
parent
commit
7ff074fca6
  1. 7
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

7
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

@ -310,9 +310,12 @@ namespace SixLabors.ImageSharp.Formats.Bmp
}
else
{
for (int i = 0; i < cmd[0]; i++)
int max = cmd[0] + count;
byte cmd1 = cmd[1];
for (; count < max; count++)
{
buffer[count++] = cmd[1];
buffer[count] = cmd1;
}
}
}

Loading…
Cancel
Save