aboutsummaryrefslogtreecommitdiff
path: root/runtime/src/ints.c
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-02-11 21:29:15 +0000
committerMichael Williamson <mike@zwobble.org>2024-02-11 21:29:15 +0000
commita01ee103f9bc0c6defe9ce8cd85651f19f7127bd (patch)
tree8634fd33dde74b4aab1519e1b61bc3343d99606f /runtime/src/ints.c
parent3d4e3f4a54d128a2a280b5adc921f3d95fb963bb (diff)
Create separate lib for patio runtime
Diffstat (limited to 'runtime/src/ints.c')
-rw-r--r--runtime/src/ints.c46
1 files changed, 0 insertions, 46 deletions
diff --git a/runtime/src/ints.c b/runtime/src/ints.c
deleted file mode 100644
index 572a2ee7..00000000
--- a/runtime/src/ints.c
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <stdbool.h>
-
-#include "./patio/patio.h"
-#include "./gc.h"
-#include "./primitives.h"
-
-struct ShedInt {
- struct ShedGcObjectHeader gc_object_header;
- PatioInt value;
-};
-
-ShedObject shed__runtime__int_create(PatioInt value) {
- struct ShedInt* result = shed__runtime__gc_alloc(sizeof(struct ShedInt), 0);
- result->value = value;
- return (ShedObject) result;
-}
-
-PatioInt shed__runtime__int_value(ShedObject object) {
- return ((struct ShedInt*) object)->value;
-}
-
-ShedObject shed__runtime__int_add(ShedObject left, ShedObject right) {
- PatioInt left_value = shed__runtime__int_value(left);
- PatioInt right_value = shed__runtime__int_value(right);
- PatioInt result_value = left_value + right_value;
- return shed__runtime__int_create(result_value);
-}
-
-ShedObject shed__runtime__int_sub(ShedObject left, ShedObject right) {
- PatioInt left_value = shed__runtime__int_value(left);
- PatioInt right_value = shed__runtime__int_value(right);
- PatioInt result_value = left_value - right_value;
- return shed__runtime__int_create(result_value);
-}
-
-bool shed__runtime__int_equals(ShedObject left, ShedObject right) {
- PatioInt left_value = shed__runtime__int_value(left);
- PatioInt right_value = shed__runtime__int_value(right);
- return left_value == right_value;
-}
-
-bool shed__runtime__int_not_equal(ShedObject left, ShedObject right) {
- PatioInt left_value = shed__runtime__int_value(left);
- PatioInt right_value = shed__runtime__int_value(right);
- return left_value != right_value;
-}