1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-07-03 10:29:58 +00:00

Fix >32bit constants

This commit is contained in:
Karol Stasiak 2020-03-26 01:36:41 +01:00
parent 5215400cb2
commit 2a3c9f04be

View File

@ -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