Represent negative constants as negative values instead of -1 * positiveValue
This commit is contained in:
parent
62528a6d75
commit
eb03afe343
1 changed files with 1 additions and 0 deletions
|
|
@ -33,4 +33,5 @@ simplifyFactor :: Parser.Factor -> Node
|
||||||
simplifyFactor factor = case factor of
|
simplifyFactor factor = case factor of
|
||||||
Parser.Integer i -> Scalar i
|
Parser.Integer i -> Scalar i
|
||||||
Parser.Parantheses expr -> simplifyExpr expr
|
Parser.Parantheses expr -> simplifyExpr expr
|
||||||
|
Parser.NegFactor (Parser.Integer i) -> Scalar (-i) -- Shortcut to avoid storing -x as -1 * x
|
||||||
Parser.NegFactor factor2 -> Operation Mult (Scalar (-1)) (simplifyFactor factor2)
|
Parser.NegFactor factor2 -> Operation Mult (Scalar (-1)) (simplifyFactor factor2)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue