diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-12-29 00:07:16 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-12-29 00:07:16 +0200 |
| commit | 90b0d817fedfa5715b195e16da67fa6bdd67638e (patch) | |
| tree | de5c01884a434ffcc940be2e96474f188c95362c /mod/mem.c | |
| parent | 0e0c41af58a0f4ec5a39ce77822de71e5523fcba (diff) | |
| download | fwd-90b0d817fedfa5715b195e16da67fa6bdd67638e.tar.gz fwd-90b0d817fedfa5715b195e16da67fa6bdd67638e.zip | |
work towards a simple integer vector implementationgnc
+ Hopefully shows that useful programs can be implemented with
the rules present
+ Still missing at least external functions with non-void returns
Diffstat (limited to 'mod/mem.c')
| -rw-r--r-- | mod/mem.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -24,6 +24,15 @@ long fwdfree(fwd_extern_args_t args) return 0; } +long fwdptradd(fwd_extern_args_t args) +{ + assert(args.argc == 2); + void *ptr = FWD_ARG(args, 0, void *, FWD_PTR); + int64_t add = FWD_ARG_T(args, 1, int64_t); + FWD_RET(FWD_PTR, (char *)ptr + add); + return 0; +} + int fwdopen(fwd_state_t *state) { FWD_REGISTER(state, fwdmalloc, @@ -34,5 +43,8 @@ int fwdopen(fwd_state_t *state) FWD_REGISTER(state, fwdfree, FWD_VOID, FWD_PTR); + + FWD_REGISTER(state, fwdptradd, + FWD_PTR, FWD_PTR, FWD_T(int64_t)); return 0; } |
