Template Function liberate::serialization::uleb128_serialize_varint

Function Documentation

template<typename outT, std::enable_if_t<liberate::types::is_8bit_type<outT>::value, int> = 0>
std::size_t liberate::serialization::uleb128_serialize_varint(outT *output, std::size_t output_length, ::liberate::types::varint const &value)

Serialize to buffer with ULEB128.

The buffer is defined by a pointer and a size. The input is an integer value for which serialize_int is explicitly enabled (see above).

If the buffer is too small, zero is returned. Otherwise, the number of units written to the buffer is.

Note: the function is restricted to 8-bit output buffer types only.

Parameters
  • output[out] The output buffer to serialize to.

  • output_length[in] The length of the output buffer.

  • value[in] The varint value.

Returns

The number of bytes of output buffer consumed or 0 on failure.