commit | 4d589e719ba0f7c2421dbb98208de51c3e1cee1d | [log] [tgz] |
---|---|---|
author | Willy Tarreau <w@1wt.eu> | Fri Aug 23 19:02:26 2019 +0200 |
committer | Willy Tarreau <w@1wt.eu> | Tue Aug 27 17:14:19 2019 +0200 |
tree | 36c4027eb8e18370f79342b2acfd4798f8d885d5 | |
parent | 799e9ed62b4384a16340d301ee6ab490a082318a [diff] |
MINOR: tools: add a function varint_bytes() to report the size of a varint It will sometimes be useful to encode varints to know the output size in advance. Two versions are provided, one inline using a switch/case construct which will be trivial for use with constants (and will be very fast albeit huge) and one function iterating on the number which is 5 times smaller, for use with variables.