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:
parent
14d05c61b6
commit
fcda94f258
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user