From 2a3c9f04beea02bd758cbf7c1209d6d398840f03 Mon Sep 17 00:00:00 2001 From: Karol Stasiak Date: Thu, 26 Mar 2020 01:36:41 +0100 Subject: [PATCH] Fix >32bit constants --- src/main/scala/millfork/env/Environment.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/millfork/env/Environment.scala b/src/main/scala/millfork/env/Environment.scala index 2a2926c3..b94b1b08 100644 --- a/src/main/scala/millfork/env/Environment.scala +++ b/src/main/scala/millfork/env/Environment.scala @@ -1814,8 +1814,8 @@ class Environment(val parent: Option[Environment], val prefix: String, val cpuFa if (stmt.initialValue.isEmpty) log.error(s"`$name` is a constant and requires a value", position) val rawConstantValue = stmt.initialValue.flatMap(eval).getOrElse(errorConstant(s"`$name` has a non-constant value", position)).quickSimplify rawConstantValue match { - case NumericConstant(nv, _) if nv >= 2 => - if (nv >= 1.<<(8*typ.size)) { + case NumericConstant(nv, _) if nv >= 2 && typ.size < 8 => + if (nv >= 1L.<<(8*typ.size)) { log.error(s"Constant value $nv too big for type ${typ.name}", stmt.position) } case _ => // ignore