Skip to main content

Module varint

Module varint 

Source
Expand description

QUIC variable-length integers (RFC 9000 §16), the integer of every HTTP/3 frame and stream header.

The two most significant bits of the first octet give the length (1, 2, 4 or 8 octets); the rest is the value, network byte order, up to 2^62 - 1.

Constants§

MAX
The largest value: 2^62 - 1.

Functions§

decode
Decodes one integer. Returns it and the octets used. A value written in a longer form than it needs is accepted, as RFC 9000 §16 allows.
encode
Appends the shortest encoding of v.
len
The length of the shortest encoding of v; 8 for anything above MAX, which encode refuses.