VirtualBox

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

最後變更 在這個檔案是 98730,由 vboxsync 提交於 2 年 前

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

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 630 位元組
 
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}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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