diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-06-24 20:48:32 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-06-24 22:10:50 +0300 |
| commit | 422b6c976e28445d2a6e14586fa416b0f16c093f (patch) | |
| tree | a6bf3364cec45ed0c5d48e346a76a98fe9d0094a /src/main.c | |
| download | copyjit-422b6c976e28445d2a6e14586fa416b0f16c093f.tar.gz copyjit-422b6c976e28445d2a6e14586fa416b0f16c093f.zip | |
initial commit
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..be93061 --- /dev/null +++ b/src/main.c @@ -0,0 +1,32 @@ +#include <stdint.h> +#include <stddef.h> + +#include "copyjit.h" + +int main() +{ + ctx_t ctx; + compile_start(&ctx); + + compile_uli(&ctx, 0); // total in a + compile_movao(&ctx); + + compile_uli(&ctx, 0); + compile_movyo(&ctx); // iter in y + + void *top = compile_movxa(&ctx); // iter + total in a + compile_add(&ctx); + + compile_incy(&ctx); // increment iter + compile_uli(&ctx, 1000000000); // limit in o + compile_subyo(&ctx); + + compile_uli(&ctx, (uintptr_t)top); // branch target in o + compile_ban(&ctx); + + compile_end(&ctx); + + compile_finish(&ctx); + + run(&ctx); +} |
