VirtualBox

source: vbox/trunk/src/libs/liblzma-5.4.1/common/vli_size.c@ 98879

Last change on this file since 98879 was 98730, checked in by vboxsync, 21 months ago

libs/liblzma-5.4.1: Export to OSE, bugref:10254

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 630 bytes
Line 
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.
10//
11///////////////////////////////////////////////////////////////////////////////
12
13#include "common.h"
14
15
16extern LZMA_API(uint32_t)
17lzma_vli_size(lzma_vli vli)
18{
19 if (vli > LZMA_VLI_MAX)
20 return 0;
21
22 uint32_t i = 0;
23 do {
24 vli >>= 7;
25 ++i;
26 } while (vli != 0);
27
28 assert(i <= LZMA_VLI_BYTES_MAX);
29 return i;
30}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette