47 [[nodiscard]]
static auto encode(uint64_t value) -> std::vector<uint8_t>;
64 [[nodiscard]]
static auto decode(std::span<const uint8_t> data)
72 [[nodiscard]]
static constexpr auto encoded_length(uint64_t value)
noexcept ->
size_t
82 if (value <= 1073741823)
96 return size_t{1} << (first_byte >> 6);
104 [[nodiscard]]
static constexpr auto is_valid(uint64_t value)
noexcept ->
bool
QUIC variable-length integer encoding/decoding (RFC 9000 Section 16)
static constexpr auto encoded_length(uint64_t value) noexcept -> size_t
Get the number of bytes needed to encode a value.
static constexpr uint64_t max_4byte
static constexpr auto is_valid(uint64_t value) noexcept -> bool
Check if a value can be encoded as a varint.
static constexpr uint8_t prefix_1byte
static constexpr uint8_t prefix_mask
static constexpr auto length_from_prefix(uint8_t first_byte) noexcept -> size_t
Get encoded length from the first byte's prefix.
static auto encode(uint64_t value) -> std::vector< uint8_t >
Encode a value to variable-length format.
static auto decode(std::span< const uint8_t > data) -> Result< std::pair< uint64_t, size_t > >
Decode variable-length integer from buffer.
static constexpr uint8_t prefix_4byte
static constexpr uint64_t max_8byte
static constexpr uint8_t prefix_2byte
static auto encode_with_length(uint64_t value, size_t min_length) -> Result< std::vector< uint8_t > >
Encode with minimum length requirement.
static constexpr uint64_t max_2byte
static constexpr uint8_t value_mask
static constexpr uint8_t prefix_8byte
static constexpr uint64_t max_1byte
Maximum value for each encoded length.
constexpr uint64_t varint_max
Maximum value that can be encoded in QUIC variable-length integer.
Network-specific error and result type definitions.