GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / tools / misc / xz / src / liblzma / common / vli_size.c
blobec1b4fa488b6afcb5093f56085a13a81cb8d1434
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file vli_size.c
4 /// \brief Calculates the encoded size of a variable-length integer
5 //
6 // Author: Lasse Collin
7 //
8 // This file has been put into the public domain.
9 // You can do whatever you want with this file.
11 ///////////////////////////////////////////////////////////////////////////////
13 #include "common.h"
16 extern LZMA_API(uint32_t)
17 lzma_vli_size(lzma_vli vli)
19 if (vli > LZMA_VLI_MAX)
20 return 0;
22 uint32_t i = 0;
23 do {
24 vli >>= 7;
25 ++i;
26 } while (vli != 0);
28 assert(i <= LZMA_VLI_BYTES_MAX);
29 return i;