moonvar integers as octets

Bit lab

Where the bits go

One integer, written by every encoding in the module. The cells below are the octets the library produced, opened up: a bit that carries part of the value, a bit that names a width, a bit that says another octet follows.

prefix · says the width flags · the field's own bits continuation · another octet follows marker · which width follows value

Cost

What each one spends

Octets per value, measured by calling each encoder. A narrow value costs one octet almost everywhere; the encodings only diverge once the value outgrows a single octet, and by 232−1 the fixed width has been paying for eight octets for a while.

value quic prefix(5) leb128 lenenc fixed
reading…

The bar length is the octet count out of ten, the most any of them needs for a sixty-four-bit value. A dash means the value is past that encoding's ceiling — QUIC stops at 262−1, and the prefix reader holds a signed 31-bit value.

The other direction

Give them bytes

Each reader is handed the whole run and answers with what it read and how much of it it used. Where two encodings read the same octets and disagree, the disagreement is the point: the octets do not carry which rule wrote them.

pairs of hex digits; spaces are ignored