From b1e5176aff7d1eae3726831ac3adc3f0a4222614 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Mon, 16 Sep 2019 22:48:46 +0200 Subject: [PATCH] Allow larger nontrivial constants --- .../millfork/compiler/AbstractExpressionCompiler.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/scala/millfork/compiler/AbstractExpressionCompiler.scala b/src/main/scala/millfork/compiler/AbstractExpressionCompiler.scala index 6604ed62..b938d348 100644 --- a/src/main/scala/millfork/compiler/AbstractExpressionCompiler.scala +++ b/src/main/scala/millfork/compiler/AbstractExpressionCompiler.scala @@ -276,7 +276,7 @@ object AbstractExpressionCompiler { case 1 => b case 2 => w case 3 => env.get[Type]("int24") - case 4 => env.get[Type]("long") + case 4 => env.get[Type]("int32") } case ConstantArrayElementExpression(constant) => (constant.quickSimplify match { @@ -288,7 +288,7 @@ object AbstractExpressionCompiler { case (true, 1) => env.get[Type]("sbyte") case (_, 2) => b case (_, 3) => env.get[Type]("int24") - case (_, 4) => env.get[Type]("long") + case (_, 4) => env.get[Type]("int32") } case GeneratedConstantExpression(_, typ) => typ case TextLiteralExpression(_) => env.get[Type]("pointer") @@ -401,7 +401,9 @@ object AbstractExpressionCompiler { case SumExpression(params, _) => params.map { case (_, e) => getExpressionTypeImpl(env, log, e, loosely).size }.max match { case 1 => b case 2 => w - case _ => log.error("Adding values bigger than words", expr.position); w + case 3 => env.get[Type]("int24") + case 4 => env.get[Type]("int32") + case _ => log.error("Adding values bigger than longs", expr.position); env.get[Type]("int32") } case FunctionCallExpression("nonet", _) => w case FunctionCallExpression("not", params) =>