Module vlq_bij::be128

source ·
Expand description

Read and write base 128, big-endian, bijective variable-length quantities.

This is the same bijective VLQ used by git.

The high bit of each byte indicates whether there is another byte to follow, and the lower seven bits hold the base 128 digit. These digits are orders with the most significant digits first.

The base 128 digits are adjusted so that there is a unique encoding for each non-negative integer. The value represented by n 0x7f digits is one less than the values represented by n+1 0x00 digits.

The numeric sort order of the values matches the lexiographic sort order of encoded values.

Enums

  • Possible errors when encoding and decoding.

Traits

  • Types that can be encoded and decode from a VLQ.

Functions

  • Read a base-128 big-endian bijective variable length quantity from reader.
  • Write a base-128 big-endian bijective variable length quantity to writer.