From 5cdc599b1d2f96beba6b244ac9a49dc95aa6ea32 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Sun, 29 Mar 2020 01:45:31 +0100 Subject: [PATCH] Avoid overflow errors when estimating memset sizes --- .../millfork/compiler/AbstractStatementPreprocessor.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/millfork/compiler/AbstractStatementPreprocessor.scala b/src/main/scala/millfork/compiler/AbstractStatementPreprocessor.scala index 34170361..e2a638e8 100644 --- a/src/main/scala/millfork/compiler/AbstractStatementPreprocessor.scala +++ b/src/main/scala/millfork/compiler/AbstractStatementPreprocessor.scala @@ -227,9 +227,9 @@ abstract class AbstractStatementPreprocessor(protected val ctx: CompilationConte ) { val sizeExpr = f.direction match { case ForDirection.DownTo => - f.start #-# f.end #+# 1 + f.start #-# f.end #+# LiteralExpression(1, 2) case ForDirection.To | ForDirection.ParallelTo => - f.end #-# f.start #+# 1 + f.end #-# f.start #+# LiteralExpression(1, 2) case ForDirection.Until | ForDirection.ParallelUntil => f.end #-# f.start }