Skip to main content

Module varint

Module varint 

Source
Expand description

Variable-length integer encoding utilities.

Two encodings are used:

  • Little-endian (low bits first): linetable
  • Big-endian (high bits first): exception tables

Both use 6-bit chunks with 0x40 as the continuation bit.

Functionsยง

read_varint
Read a big-endian varint (no start marker).
read_varint_with_start
Read a big-endian varint with start marker (0x80).
write_signed_varint
Write a little-endian signed varint.
write_varint
Write a little-endian varint (used by linetable).
write_varint_be
Write a big-endian varint (used by exception tables).
write_varint_with_start
Write a big-endian varint with the start marker (0x80) on the first byte.