VirtualBox

source: vbox/trunk/src/libs/liblzma-5.8.1/common/vli_size.c@ 108911

Last change on this file since 108911 was 108911, checked in by vboxsync, 4 weeks ago

libs/liblzma: Applied and adjusted our liblzma changes to 5.8.1 and export to OSE. jiraref:VBP-1635

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property sync-process set to export
File size: 561 bytes
Line 
1// SPDX-License-Identifier: 0BSD
2
3///////////////////////////////////////////////////////////////////////////////
4//
5/// \file vli_size.c
6/// \brief Calculates the encoded size of a variable-length integer
7//
8// Author: Lasse Collin
9//
10///////////////////////////////////////////////////////////////////////////////
11
12#include "common.h"
13
14
15extern LZMA_API(uint32_t)
16lzma_vli_size(lzma_vli vli)
17{
18 if (vli > LZMA_VLI_MAX)
19 return 0;
20
21 uint32_t i = 0;
22 do {
23 vli >>= 7;
24 ++i;
25 } while (vli != 0);
26
27 assert(i <= LZMA_VLI_BYTES_MAX);
28 return i;
29}
Note: See TracBrowser for help on using the repository browser.

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