Browse Source

#771: change order of addition as proposed by @dlemstra

added comments as explanation
pull/771/head
Unknown 7 years ago
parent
commit
321cca6e81
  1. 4
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

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

@ -310,8 +310,8 @@ namespace SixLabors.ImageSharp.Formats.Bmp
}
else
{
int max = cmd[0] + count;
byte cmd1 = cmd[1];
int max = count + cmd[0]; // as we start at the current count in the following loop, max is count + cmd[0]
byte cmd1 = cmd[1]; // store the value to avoid the repeated indexer access inside the loop
for (; count < max; count++)
{

Loading…
Cancel
Save