From 8b1d8698e9abe244aa8ce4c54b0ae0e18c6c7264 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Wed, 2 Feb 2022 23:55:43 -0500 Subject: 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. --- std/math.cup | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 std/math.cup (limited to 'std/math.cup') 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 -- cgit v1.2.3