MINOR: tools: add a function varint_bytes() to report the size of a varint
authorWilly Tarreau <w@1wt.eu>
Fri, 23 Aug 2019 17:02:26 +0000 (19:02 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Aug 2019 15:14:19 +0000 (17:14 +0200)
commit4d589e719ba0f7c2421dbb98208de51c3e1cee1d
tree36c4027eb8e18370f79342b2acfd4798f8d885d5
parent799e9ed62b4384a16340d301ee6ab490a082318a
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.
include/common/standard.h
src/standard.c