6 The ``pw_varint`` module provides functions for encoding and decoding variable
7 length integers, or varints. For smaller values, varints require less memory
8 than a fixed-size encoding. For example, a 32-bit (4-byte) integer requires 1--5
9 bytes when varint-encoded.
11 `Protocol Buffers <https://developers.google.com/protocol-buffers/docs/encoding#varints>`_
12 use a variable-length encoding for integers.
17 * C++11 (with :doc:`../pw_polyfill/docs`)
22 .. cpp:function:: size_t EncodedSize(uint64_t integer)
24 Returns the size of an integer when encoded as a varint. Works on both signed
25 and unsigned integers.
27 .. cpp:function:: size_t ZigZagEncodedSize(int64_t integer)
29 Returns the size of a signed integer when ZigZag encoded as a varint.