From d940187fd8720e0ab3c00e5a6a7ae8f181c7752d Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sun, 12 Feb 2023 15:37:25 -0800 Subject: Add lambda functions. --- bytecode/.encoding.c.swp | Bin 0 -> 12288 bytes bytecode/slice.c | 25 ------------------------- bytecode/value.c | 4 ++-- 3 files changed, 2 insertions(+), 27 deletions(-) create mode 100644 bytecode/.encoding.c.swp delete mode 100644 bytecode/slice.c (limited to 'bytecode') diff --git a/bytecode/.encoding.c.swp b/bytecode/.encoding.c.swp new file mode 100644 index 0000000..fc8e88a Binary files /dev/null and b/bytecode/.encoding.c.swp 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 - -#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; } -- cgit v1.3.1