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:
1.3 KB
|
Line | |
---|
1 | // SPDX-License-Identifier: 0BSD
|
---|
2 |
|
---|
3 | ///////////////////////////////////////////////////////////////////////////////
|
---|
4 | //
|
---|
5 | /// \file fastpos_tablegen.c
|
---|
6 | /// \brief Generates the lzma_fastpos[] lookup table
|
---|
7 | ///
|
---|
8 | // Authors: Igor Pavlov
|
---|
9 | // Lasse Collin
|
---|
10 | //
|
---|
11 | ///////////////////////////////////////////////////////////////////////////////
|
---|
12 |
|
---|
13 | #include <inttypes.h>
|
---|
14 | #include <stdio.h>
|
---|
15 |
|
---|
16 | #define lzma_attr_visibility_hidden
|
---|
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 | // Split the SPDX string so that it won't accidentally match
|
---|
38 | // when tools search for the string.
|
---|
39 | printf("// SPDX" "-License-Identifier" ": 0BSD\n\n"
|
---|
40 | "// This file has been generated by fastpos_tablegen.c.\n\n"
|
---|
41 | "#include \"common.h\"\n"
|
---|
42 | "#include \"fastpos.h\"\n\n"
|
---|
43 | "const uint8_t lzma_fastpos[1 << FASTPOS_BITS] = {");
|
---|
44 |
|
---|
45 | for (size_t i = 0; i < (1 << FASTPOS_BITS); ++i) {
|
---|
46 | if (i % 16 == 0)
|
---|
47 | printf("\n\t");
|
---|
48 |
|
---|
49 | printf("%3u", (unsigned int)(fastpos[i]));
|
---|
50 |
|
---|
51 | if (i != (1 << FASTPOS_BITS) - 1)
|
---|
52 | printf(",");
|
---|
53 | }
|
---|
54 |
|
---|
55 | printf("\n};\n");
|
---|
56 |
|
---|
57 | return 0;
|
---|
58 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.