aboutsummaryrefslogtreecommitdiff
path: root/ops/common.h
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-08-02 20:54:08 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-08-02 20:54:08 +0300
commit9251fddfdfb11b9e1b2dff643aa20ec82e9f7036 (patch)
treefa6045ac60ab66cfd04b820d50b9f92f86f2bfc7 /ops/common.h
parent6c12792402503705bf921d56ea3b309408bb417a (diff)
downloadcopyjit-9251fddfdfb11b9e1b2dff643aa20ec82e9f7036.tar.gz
copyjit-9251fddfdfb11b9e1b2dff643aa20ec82e9f7036.zip
add return values to main loop
Diffstat (limited to 'ops/common.h')
-rw-r--r--ops/common.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/ops/common.h b/ops/common.h
index 546b064..6b124b3 100644
--- a/ops/common.h
+++ b/ops/common.h
@@ -6,19 +6,22 @@
typedef unsigned long reg_t;
typedef signed long sreg_t;
-typedef void (*op_call)(reg_t *sp, reg_t a, reg_t x, reg_t y, reg_t o);
+typedef reg_t (*op_call)(reg_t *sp, reg_t a, reg_t x, reg_t y, reg_t o);
#define NEXT_OP(sp, a, x, y, o) \
- ((op_call)(&__next_op))((sp), (a), (x), (y), (o));
+ return ((op_call)(&__next_op))((sp), (a), (x), (y), (o));
-#define JUMP(target, sp, a, x, y, o) \
+#define CALL(target, sp, a, x, y, o) \
((op_call)(target))((sp), (a), (x), (y), (o));
+#define JUMP(target, sp, a, x, y, o) \
+ return CALL(target, sp, a, x, y, o);
+
#define BRANCH(target, cond, sp, a, x, y, o) \
- ((op_call)((cond) ? (void *)(target) : (void *)&__next_op)) \
+ return ((op_call)((cond) ? (void *)(target) : (void *)&__next_op)) \
((sp), (a), (x), (y), (o)); \
-#define DEFINE_OP(name) void _op(reg_t *sp, reg_t a, reg_t x, reg_t y, reg_t o)
+#define DEFINE_OP(name) reg_t _op(reg_t *sp, reg_t a, reg_t x, reg_t y, reg_t o)
#define UNUSED(x) (void)(x);