Files
rose-ash/lib
giles 810f61a1c1
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 19s
ocaml: phase 5.1 adler32.ml baseline (Adler-32 of 'Wikipedia' = 300286872 = 0x11E60398)
Two running sums modulo 65521:

  a = (1 + sum of bytes)            mod 65521
  b = sum of running 'a' values     mod 65521
  checksum = b * 65536 + a

  let adler32 s =
    let a = ref 1 in
    let b = ref 0 in
    let m = 65521 in
    for i = 0 to String.length s - 1 do
      a := (!a + Char.code s.[i]) mod m;
      b := (!b + !a) mod m
    done;
    !b * 65536 + !a

For 'Wikipedia': 0x11E60398 = 300286872 (the canonical test value).

Tests for-loop accumulating two refs together, modular arithmetic,
and Char.code on s.[i].

96 baseline programs total.
2026-05-09 19:18:01 +00:00
..