aboutsummaryrefslogtreecommitdiff
path: root/docs/history/13-gap-fixes/code/tests/enhance.zc
diff options
context:
space:
mode:
authorGravatar Moon Flower <moonflower@elhenney.local> 2026-10-14 09:09:21 +0330
committerGravatar Moon Flower <moonflower@elhenney.local> 2026-10-14 09:09:21 +0330
commitdc7f7407e08f54e4a2a3c1d1723b2a7d6959532d (patch)
treed1de9f471a99951c57896f85b5e5523eeb96cee1 /docs/history/13-gap-fixes/code/tests/enhance.zc
parenttodo: sync docs, examples and fixtures with the include format, and test acto... (diff)
docs: archive the frozen stage code as one compressed tarball
docs/history kept six stages with a full copy of the project under code/, 3.8 mb of sources duplicated from stage to stage and already superseded. store them as docs/history/code-snapshots.tar.gz, 0.66 mb, and extract one in place to read it. every stage's notes.md stays browsable, and the index says where the code went and how to get it back. the top-level README points at the archive too. its other two links into docs/history, 21-micro and 35-bench, were notes that were never kept and do not resolve; the index now records that.
Diffstat (limited to 'docs/history/13-gap-fixes/code/tests/enhance.zc')
-rw-r--r--docs/history/13-gap-fixes/code/tests/enhance.zc29
1 files changed, 0 insertions, 29 deletions
diff --git a/docs/history/13-gap-fixes/code/tests/enhance.zc b/docs/history/13-gap-fixes/code/tests/enhance.zc
deleted file mode 100644
index 6acc742..0000000
--- a/docs/history/13-gap-fixes/code/tests/enhance.zc
+++ /dev/null
@@ -1,29 +0,0 @@
-// custom opcodes: recipes, lifted vm code, several outputs, and a fallback
-enhance clampadd(a, b) micro "a = add a b; a = min a 100; a = max a 0";
-enhance cube(x) vm { 0 $ 0 $ * * };
-enhance divmod(a, b) -> 2 micro "r2 = sdiv a b" "\n r1 = srem a b\n r0 = r2";
-enhance div7(a) micro "a = sdiv a 7";
-enhance urem10(a) micro "a = urem a 10";
-enhance hi(a, b) micro "a = mulhu a b";
-enhance noisy(x) vm { 0 $ . } else soft_noisy; // i/o can't be lifted, so calls use the fallback
-fn soft_noisy(x) { return x + 1; }
-let qq, rr, seed = 7;
-fn rnd() { seed = seed * 1103515245 + 12345; return seed ^ (seed >> 11); }
-fn main()
-{
- let i = 0, a, bad = 0;
- putn(clampadd(70, 50)); putc(' '); putn(clampadd(-50, 2)); putc(' '); putn(cube(7)); putc(' ');
- asm { 17 5 divmod rr ! qq ! }
- putn(qq); putc(','); putn(rr); putc(' ');
- putn(noisy(4)); putc(' ');
- putn(hi(-1, -1)); putc(' ');
- while (i < 5000) {
- a = rnd();
- if (div7(a) != zdiv(a, 7)) bad++;
- if (urem10(a) < 0 || urem10(a) > 9) bad++;
- if (a / (i + 1) != zdiv(a, i + 1)) bad++;
- i++;
- }
- putn(bad); putc(10);
- return 0;
-}