mirror of
https://github.com/cc65/cc65.git
synced 2024-11-16 02:10:52 +00:00
Made a slight improvement in the ld65 expression evaluator.
This commit is contained in:
parent
14d05c61b6
commit
fcda94f258
@ -321,20 +321,18 @@ long GetExprVal (ExprNode* Expr)
|
|||||||
return GetExprVal (Expr->Left) * GetExprVal (Expr->Right);
|
return GetExprVal (Expr->Left) * GetExprVal (Expr->Right);
|
||||||
|
|
||||||
case EXPR_DIV:
|
case EXPR_DIV:
|
||||||
Left = GetExprVal (Expr->Left);
|
|
||||||
Right = GetExprVal (Expr->Right);
|
Right = GetExprVal (Expr->Right);
|
||||||
if (Right == 0) {
|
if (Right == 0) {
|
||||||
Error ("Division by zero");
|
Error ("Division by zero");
|
||||||
}
|
}
|
||||||
return Left / Right;
|
return GetExprVal (Expr->Left) / Right;
|
||||||
|
|
||||||
case EXPR_MOD:
|
case EXPR_MOD:
|
||||||
Left = GetExprVal (Expr->Left);
|
|
||||||
Right = GetExprVal (Expr->Right);
|
Right = GetExprVal (Expr->Right);
|
||||||
if (Right == 0) {
|
if (Right == 0) {
|
||||||
Error ("Modulo operation with zero");
|
Error ("Modulo operation with zero");
|
||||||
}
|
}
|
||||||
return Left % Right;
|
return GetExprVal (Expr->Left) % Right;
|
||||||
|
|
||||||
case EXPR_OR:
|
case EXPR_OR:
|
||||||
return GetExprVal (Expr->Left) | GetExprVal (Expr->Right);
|
return GetExprVal (Expr->Left) | GetExprVal (Expr->Right);
|
||||||
|
Loading…
Reference in New Issue
Block a user