Files
reverse-engineering-anything/src
XiaoBinGan a3acfcf003 fix(entropy): keep the whole-file census in a counter that cannot wrap
The previous commit moved the whole-file census into a `Uint32Array`. That bin wraps
at 2^32 occurrences of one byte, and the service admits files up to
`Number.MAX_SAFE_INTEGER`, so a 6 GiB zero-filled file reported
`entropyFromCounts(counts, size)` = 0.5283 instead of 0.

Measured on 8 MiB, three interleaved runs against the compiled counter:

| form | time |
| --- | --- |
| `for...of` + `Float64Array` | 79.59ms |
| indexed + `Float64Array` | 9.26ms |
| indexed + `Uint32Array` | 9.28ms |

The 8x comes from the indexed reads, not from the integer bin, so exactness costs
nothing here. The bounded block counter stays bounded by `block_size` (max 65536) and
also uses a `Float64Array` so the two counters read the same.

`wholeFileByteCounts` names the counter the service uses, so the test can assert the
property that matters: a count above 2^32 survives. It fails on the previous commit.

`src/domain/native` + `src/application/binaryDiagnostics`: 443 passing. One test fails
on this Windows host before and after this diff — `reports a changed artifact when its
parent directory moves during streaming` fails with `ENOENT` on a directory rename.
`tsc` 0; `npm run lint` 0 errors; `knip` 0.
2026-11-21 21:12:12 +01:00
..
…