FOR (frame of reference)
FOR stores n integers as a Packed array: a minimum and the offset of each value from it. It is codec id 1 in Flat and in IntCol, with the same layout in both.
Layout
Section titled “Layout”| Field | Encoding | Meaning |
|---|---|---|
| count | varint | n, the number of values |
| codec | u8 | 1 |
| body | Packed(n) |
zvarint min, width u8, then the bit stream |
How to decode
Section titled “How to decode”- Read
countand check it against its limit. - Read the codec byte. It is 1.
- Decode
Packed(n): min, width (at most 64), thennoffsets ofwidthbits each. - Value
iismin + offset[i].
Illustration
Section titled “Illustration”Derived by hand, not from a real file. The values 10, 13, 15, 17 have min = 10 and offsets 0, 3, 5, 7, so width 3 (the worked bit packing is on Packed integers).
04 01 14 03 58 0F count 4, codec FOR, min 10, width 3, offsets 0 3 5 7Checks
Section titled “Checks”- Everything that Packed checks: width at most 64 and enough input bytes.
countis within its limit.
When writers pick it
Section titled “When writers pick it”See How writers choose a codec.