Skip to content

CONST stores one integer and repeats it n times. It is codec id 0 in Flat and in IntCol, with the same layout in both.

Field Encoding Meaning
count varint n, the number of values
codec u8 0
v zvarint the value, see zvarint

When n = 0 the writer stores v = 0.

  1. Read count and check it against its limit.
  2. Read the codec byte. It is 0.
  3. Read v as a zvarint.
  4. The stream is n copies of v.

Derived by hand, not from a real file. Five copies of -3: zvarint of -3 is z = (-3 << 1) xor (-3 >> 63) = 5.

05 00 05 count 5, codec CONST, v = -3

Decoded: -3, -3, -3, -3, -3.

  • count is within its limit.
  • The zvarint is complete (a truncated or over-long varint is Corrupt).

See How writers choose a codec.