summaryrefslogtreecommitdiffstats
path: root/bytecode
diff options
context:
space:
mode:
authorRose Hogenson <rhogenson@posteo.net>2023-02-12 15:37:25 -0800
committerRose Hogenson <rhogenson@posteo.net>2023-02-12 15:37:25 -0800
commitd940187fd8720e0ab3c00e5a6a7ae8f181c7752d (patch)
tree69df829ae1e7fb9454008920b49db08489d939a6 /bytecode
parent5989629a7951e544ad4656672025a99ecd08c7c9 (diff)
downloadsml-d940187fd8720e0ab3c00e5a6a7ae8f181c7752d.tar.zst
Add lambda functions.
Diffstat (limited to 'bytecode')
-rw-r--r--bytecode/.encoding.c.swpbin0 -> 12288 bytes
-rw-r--r--bytecode/slice.c25
-rw-r--r--bytecode/value.c4
3 files changed, 2 insertions, 27 deletions
diff --git a/bytecode/.encoding.c.swp b/bytecode/.encoding.c.swp
new file mode 100644
index 0000000..fc8e88a
--- /dev/null
+++ b/bytecode/.encoding.c.swp
Binary files differ
diff --git a/bytecode/slice.c b/bytecode/slice.c
deleted file mode 100644
index 0739a4a..0000000
--- a/bytecode/slice.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <assert.h>
-
-#include "slice.h"
-
-struct slice slice(struct slice a, size_t i, size_t j)
-{
- assert(i <= a.size && j <= a.size && i <= j);
- return (struct slice) { .size = j - i, .buf = a.buf + i };
-}
-
-struct slice slice1(struct slice a, size_t i)
-{
- return slice(a, i, a.size);
-}
-
-struct val_slice val_slice(struct val_slice a, size_t i, size_t j)
-{
- assert(i <= a.size && j <= a.size && i <= j);
- return (struct val_slice) { .size = j - i, .buf = a.buf + i };
-}
-
-struct val_slice val_slice1(struct val_slice a, size_t i)
-{
- return val_slice(a, i, a.size);
-}
diff --git a/bytecode/value.c b/bytecode/value.c
index 2a15b44..1b18a96 100644
--- a/bytecode/value.c
+++ b/bytecode/value.c
@@ -13,7 +13,7 @@ bool is_int(value v)
int64_t to_int(value v)
{
if (!is_int(v)) {
- panicf("value %lx is not an int!\n", v);
+ panicf("value 0x%lx is not an int!\n", v);
}
return (int64_t) v >> 1;
}
@@ -31,7 +31,7 @@ bool is_pointer(value v)
value *to_pointer(value v)
{
if (!is_pointer(v)) {
- panicf("value %lx is not a pointer!\n", v);
+ panicf("value 0x%lx is not a pointer!\n", v);
}
return (value *) v;
}