From ecc350ca5c2eb50be8309c5f14f8bf0d87db9a02 Mon Sep 17 00:00:00 2001 From: Moon Flower Date: Mon, 12 Oct 2026 08:46:23 +0330 Subject: a --- tests/programs/bench_bytes.zc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/programs/bench_bytes.zc (limited to 'tests/programs/bench_bytes.zc') diff --git a/tests/programs/bench_bytes.zc b/tests/programs/bench_bytes.zc new file mode 100644 index 0000000..cb878f6 --- /dev/null +++ b/tests/programs/bench_bytes.zc @@ -0,0 +1,19 @@ +fn sumbytes(n) { + let buf[64], i = 0, s = 0, b, reps, ch; + while (i < 64) { buf[i] = i * 0x0101010101010101; i++; } + b = addr_b(buf); + ch = get_c(); + reps = 0; + while (ch >= '0' && ch <= '9') { reps = reps * 10 + ch - '0'; ch = get_c(); } + while (reps > 0) { + i = 0; s = 0; + while (i < n) { s = s + ld8(b + (i & 511)); i++; } + reps--; + } + return s; +} +fn main() { + put_n(sumbytes(4000)); + put_c(10); + return 0; +} -- cgit v1.2.3