bindings/varint

Functions

pub fn decode(b: BitArray) -> #(Int, BitArray)

Decodes LEB128 encoded bytes to an unsigned integer.

Returns a tuple where the first element is the decoded value and the second element the bytes which have not been parsed.

This function will raise ArgumentError if the given b is not a valid LEB128 integer.

pub fn encode(num: Int) -> BitArray

Encodes an unsigned integer using LEB128 compression.

Search Document