1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 19:29:37 +00:00

Made a slight improvement in the ld65 expression evaluator.

This commit is contained in:
Greg King 2021-06-13 20:36:05 -04:00
parent 14d05c61b6
commit fcda94f258

View File

@ -321,20 +321,18 @@ long GetExprVal (ExprNode* Expr)
return GetExprVal (Expr->Left) * GetExprVal (Expr->Right);
case EXPR_DIV:
Left = GetExprVal (Expr->Left);
Right = GetExprVal (Expr->Right);
if (Right == 0) {
Error ("Division by zero");
}
return Left / Right;
return GetExprVal (Expr->Left) / Right;
case EXPR_MOD:
Left = GetExprVal (Expr->Left);
Right = GetExprVal (Expr->Right);
if (Right == 0) {
Error ("Modulo operation with zero");
}
return Left % Right;
return GetExprVal (Expr->Left) % Right;
case EXPR_OR:
return GetExprVal (Expr->Left) | GetExprVal (Expr->Right);