FA-71844 / Error-correcting codes / Member archive
Hamming correction flips the bit after the syndrome position · case 04
Single-bit errors are moved to the neighbouring bit instead of being repaired.
Case contract
Single-error-correcting Hamming decoder for a full or shortened code of length n >= 3 (bits 0/1, else None). Positions are 1-based; parity bits sit at powers of two. The syndrome is the XOR of the positions holding a 1. A syndrome above n points outside the shortened code and is "uncorrectable" (data None); otherwise the bit at the syndrome position is flipped. Return [status, data bits from non-power-of-two positions, syndrome].
Why this case matters
Memory and link controllers use (shortened) Hamming codes to repair single-bit upsets.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression [[0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1]] | ["corrected", [1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1], 13] | ["corrected", [1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1], 13] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗