aboutsummaryrefslogtreecommitdiff
path: root/std/math.cup
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-02 23:55:43 -0500
committerMustafa Quraish <[email protected]>2022-02-03 03:05:19 -0500
commit8b1d8698e9abe244aa8ce4c54b0ae0e18c6c7264 (patch)
tree01e4d24a4bbb0546ddb927e6b03f98852cee8fd6 /std/math.cup
parentAvoid pointer-arithmetic multiplications if we have `char*` (diff)
downloadcup-8b1d8698e9abe244aa8ce4c54b0ae0e18c6c7264.tar.xz
cup-8b1d8698e9abe244aa8ce4c54b0ae0e18c6c7264.zip
Move all common utilities to `std/common.cup`
In the future we can split this into multiple files if we need to, after we've added to ability to handle more complex input graphs without parsing the same file twice.
Diffstat (limited to 'std/math.cup')
-rw-r--r--std/math.cup22
1 files changed, 0 insertions, 22 deletions
diff --git a/std/math.cup b/std/math.cup
deleted file mode 100644
index d58aa86..0000000
--- a/std/math.cup
+++ /dev/null
@@ -1,22 +0,0 @@
-fn min(a: int, b: int): int {
- return a < b ? a : b;
-}
-
-fn max(a: int, b: int): int {
- return a > b ? a : b;
-}
-
-fn sign(a: int): int {
- return a > 0 ? 1 : a == 0 ? 0 : -1;
-}
-
-fn abs(a: int): int {
- return a * sign(a);
-}
-
-fn factorial(n: int): int {
- let res: int = 1;
- for (;n > 0; n = n - 1)
- res = res * n;
- return res;
-} \ No newline at end of file