Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: xz/src/liblzma/common/index.h

Issue 2869016: Add an unpatched version of xz, XZ Utils, to /trunk/deps/third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « xz/src/liblzma/common/hardware_physmem.c ('k') | xz/src/liblzma/common/index.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file index.h
4 /// \brief Handling of Index
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 #ifndef LZMA_INDEX_H
14 #define LZMA_INDEX_H
15
16 #include "common.h"
17
18
19 /// Minimum Unpadded Size
20 #define UNPADDED_SIZE_MIN LZMA_VLI_C(5)
21
22 /// Maximum Unpadded Size
23 #define UNPADDED_SIZE_MAX (LZMA_VLI_MAX & ~LZMA_VLI_C(3))
24
25
26 /// Get the size of the Index Padding field. This is needed by Index encoder
27 /// and decoder, but applications should have no use for this.
28 extern uint32_t lzma_index_padding_size(const lzma_index *i);
29
30
31 /// Set for how many Records to allocate memory the next time
32 /// lzma_index_append() needs to allocate space for a new Record.
33 /// This is used only by the Index decoder.
34 extern void lzma_index_prealloc(lzma_index *i, lzma_vli records);
35
36
37 /// Round the variable-length integer to the next multiple of four.
38 static inline lzma_vli
39 vli_ceil4(lzma_vli vli)
40 {
41 assert(vli <= LZMA_VLI_MAX);
42 return (vli + 3) & ~LZMA_VLI_C(3);
43 }
44
45
46 /// Calculate the size of the Index field excluding Index Padding
47 static inline lzma_vli
48 index_size_unpadded(lzma_vli count, lzma_vli index_list_size)
49 {
50 // Index Indicator + Number of Records + List of Records + CRC32
51 return 1 + lzma_vli_size(count) + index_list_size + 4;
52 }
53
54
55 /// Calculate the size of the Index field including Index Padding
56 static inline lzma_vli
57 index_size(lzma_vli count, lzma_vli index_list_size)
58 {
59 return vli_ceil4(index_size_unpadded(count, index_list_size));
60 }
61
62
63 /// Calculate the total size of the Stream
64 static inline lzma_vli
65 index_stream_size(lzma_vli blocks_size,
66 lzma_vli count, lzma_vli index_list_size)
67 {
68 return LZMA_STREAM_HEADER_SIZE + blocks_size
69 + index_size(count, index_list_size)
70 + LZMA_STREAM_HEADER_SIZE;
71 }
72
73 #endif
OLDNEW
« no previous file with comments | « xz/src/liblzma/common/hardware_physmem.c ('k') | xz/src/liblzma/common/index.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698