From 321cca6e815ff0abb73d3a7b2168bfa9a670fdf3 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 7 Nov 2018 18:47:08 +0100 Subject: [PATCH] #771: change order of addition as proposed by @dlemstra added comments as explanation --- src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index 5a6cc1260..ef3ca24ee 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/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++) {