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

Side by Side Diff: xz/src/liblzma/lzma/fastpos_tablegen.c

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/lzma/fastpos_table.c ('k') | xz/src/liblzma/lzma/lzma2_decoder.h » ('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 fastpos_tablegen.c
4 /// \brief Generates the lzma_fastpos[] lookup table
5 ///
6 // Authors: Igor Pavlov
7 // Lasse Collin
8 //
9 // This file has been put into the public domain.
10 // You can do whatever you want with this file.
11 //
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #include <sys/types.h>
15 #include <inttypes.h>
16 #include <stdio.h>
17 #include "fastpos.h"
18
19
20 int
21 main(void)
22 {
23 uint8_t fastpos[1 << FASTPOS_BITS];
24
25 const uint8_t fast_slots = 2 * FASTPOS_BITS;
26 uint32_t c = 2;
27
28 fastpos[0] = 0;
29 fastpos[1] = 1;
30
31 for (uint8_t slot_fast = 2; slot_fast < fast_slots; ++slot_fast) {
32 const uint32_t k = 1 << ((slot_fast >> 1) - 1);
33 for (uint32_t j = 0; j < k; ++j, ++c)
34 fastpos[c] = slot_fast;
35 }
36
37 printf("/* This file has been automatically generated "
38 "by fastpos_tablegen.c. */\n\n"
39 "#include \"common.h\"\n"
40 "#include \"fastpos.h\"\n\n"
41 "const uint8_t lzma_fastpos[1 << FASTPOS_BITS] = {");
42
43 for (size_t i = 0; i < (1 << FASTPOS_BITS); ++i) {
44 if (i % 16 == 0)
45 printf("\n\t");
46
47 printf("%3u", (unsigned int)(fastpos[i]));
48
49 if (i != (1 << FASTPOS_BITS) - 1)
50 printf(",");
51 }
52
53 printf("\n};\n");
54
55 return 0;
56 }
OLDNEW
« no previous file with comments | « xz/src/liblzma/lzma/fastpos_table.c ('k') | xz/src/liblzma/lzma/lzma2_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698