Splitting a Run Across Bounded Count Fields
A run length field can encode only a finite count. A codec needs a way to represent a longer run without overflow.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace an upper limit
If each record can repeat a symbol at most seven times, eleven consecutive As can be represented by repeat counts seven and four, when adjacent same-symbol records are allowed. See unsigned field ranges.
Test the exact boundary
Try counts one, seven, and eight. Decide whether zero has a meaning or identifies an invalid record. Boundary tests verify both the count and encoded records.[1][2]
Split when a run exceeds the representable maximum
A format allows run counts one through seven. A run of eighteen Bs can become counts seven, seven and four with the same symbol. Their total is eighteen. Whether adjacent encoded runs can share a symbol must be part of the format. See fixed-width ranges.
Maximum count per record: 7
Run length 18 → 7 + 7 + 4
All pieces within range
Original and decoded lengths agree
Define the canonical split if byte identity matters
Several valid partitions can produce the same output. A canonical encoder can use maximal chunks and then a shorter remainder. Test seven exactly and eight to verify the transition.