Static C library to use protobuf-style varint.
Encodes a unsigned long long
number into varint and stores the result in the char
array passed the buf
parameter. If you want to know how many bytes the encoded
number takes, you cans pass the bytes
parameter and the amount of bytes will
be stored there.
Decodes a varint passed as a char array and returns it as a unsigned long long
integer.
If you want to know how many bytes the decoder when through, pass a the bytes
argument and it will be stored there.
Returns the length of the varint buffer to encode this number.
Just run
make
and you should get a static library in varint.a
.
If you want to compile the example you can do
gcc example.c varint.a -o example
and run it with
./example
You can also install using clibs
clib install sorribas/varint.c
MIT