adding some operators, working on example
Some checks failed
Build / build (push) Failing after 33s
Test / build (push) Failing after 3m0s

This commit is contained in:
2026-01-20 21:52:42 +01:00
parent 35099b33e1
commit df711a196a
11 changed files with 170 additions and 68 deletions

View File

@@ -24,6 +24,7 @@ const MathOp = enum {
Div,
Mod,
Mul,
Rem,
Sub,
};
@@ -463,10 +464,8 @@ fn MathEngine(comptime T: ValueType, comptime Op: MathOp) type {
if (op2 == 0) return RuntimeError.DivisionByZero;
break :blk if (@typeInfo(TT) == .int) @divTrunc(op1, op2) else op1 / op2;
},
.Mod => blk: {
if (op2 == 0) return RuntimeError.DivisionByZero;
break :blk @mod(op1, op2);
},
.Mod => if (op2 == 0) return RuntimeError.DivisionByZero else @mod(op1, op2),
.Rem => if (op2 == 0) return RuntimeError.DivisionByZero else @rem(op1, op2),
};
}