XOR
XOR stores each float as the bitwise XOR of its 64-bit pattern with the pattern of the previous value. Equal neighbours give zero. It is codec id 2 in FloatCol.
Layout
Section titled “Layout”| Field | Encoding | Meaning |
|---|---|---|
| codec | u8 | 2 |
| xors | IntCol | bits[i] xor bits[i-1] for each value, with bits[-1] = 0 |
The number of values is the count of the IntCol. See Column container types for the IntCol layout.
How to decode
Section titled “How to decode”- Read the codec byte (2) and the IntCol.
- Let
prev = 0. - For each stored word
x, letbits = prev xor x, emit thef64with these bits, and setprev = bits.
Illustration
Section titled “Illustration”Derived by hand, not from a real file. Let b be the bit pattern of 1.0 and take the two values 1.0, 1.0. The stored words are b xor 0 = b and b xor b = 0. Decoding: prev = 0, first word gives b, second word gives b xor 0 = b. Both values are 1.0.
Checks
Section titled “Checks”- The IntCol is a valid IntCol.
- Its count is within its limit.
When writers pick it
Section titled “When writers pick it”See How writers choose a codec.