1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-09-27 12:57:41 +00:00

Fix constant simplification

This commit is contained in:
Karol Stasiak 2020-08-14 22:29:06 +02:00
parent b9cd18c3c8
commit 7427231c3d

View File

@ -563,7 +563,10 @@ case class CompoundConstant(operator: MathOperator.Value, lhs: Constant, rhs: Co
case MathOperator.Minimum => lv min rv
case MathOperator.Maximum => lv max rv
case MathOperator.Plus => lv + rv
case MathOperator.Minus => lv - rv
case MathOperator.Minus =>
val tmp = lv - rv
if (size == 1 && (tmp < -128 || tmp > 255) ) return l.quickSimplify - r.quickSimplify
tmp
case MathOperator.Times => lv * rv
case MathOperator.Shl => lv << rv
case MathOperator.Shr => lv >> rv