Fixed division in first pass
authorLukas Krickl <lukas@krickl.dev>
Tue, 19 Dec 2023 14:24:10 +0000 (15:24 +0100)
committerLukas Krickl <lukas@krickl.dev>
Tue, 19 Dec 2023 14:24:10 +0000 (15:24 +0100)
src/ulas.c

index e38e47ef940502bac1a6052305b8d74c92f07b31..d69f2e408d221d4eb3f854486538644666c02751 100644 (file)
@@ -1621,6 +1621,9 @@ int ulas_intexpreval(int i, int *rc) {
     case '*':
       return left * right;
     case '/':
+      if (ulas.pass != ULAS_PASS_FINAL) {
+        return 0;
+      }
       if (right == 0) {
         ULASERR("integer division by 0\n");
         *rc = -1;
@@ -1628,6 +1631,9 @@ int ulas_intexpreval(int i, int *rc) {
       }
       return left / right;
     case '%':
+      if (ulas.pass != ULAS_PASS_FINAL) {
+        return 0;
+      }
       if (right == 0) {
         ULASERR("integer division by 0\n");
         *rc = -1;