Apex › Data & encoding

Varint & zigzag encoding

How Protocol Buffers packs integers: seven data bits per byte plus a continuation flag, so small numbers cost one byte and you only pay for the magnitude you use. Type a value to see the bytes and their continuation bits — then meet the negative-number gotcha (a plain signed varint is always 10 bytes) and watch zigzag collapse it back to one.

More in Data & encoding