Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / pigweed / repo / pw_varint / docs.rst
1 .. _module-pw_varint:
2
3 ---------
4 pw_varint
5 ---------
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.
10
11 `Protocol Buffers <https://developers.google.com/protocol-buffers/docs/encoding#varints>`_
12 use a variable-length encoding for integers.
13
14 Compatibility
15 =============
16 * C
17 * C++11 (with :doc:`../pw_polyfill/docs`)
18
19 API
20 ===
21
22 .. cpp:function:: size_t EncodedSize(uint64_t integer)
23
24 Returns the size of an integer when encoded as a varint. Works on both signed
25 and unsigned integers.
26
27 .. cpp:function:: size_t ZigZagEncodedSize(int64_t integer)
28
29 Returns the size of a signed integer when ZigZag encoded as a varint.
30
31 Dependencies
32 ============
33 * ``pw_span``