2 * lzx-common.c - Common data for LZX compression and decompression.
6 * Copyright (C) 2012, 2013 Eric Biggers
8 * This file is part of wimlib, a library for working with WIM files.
10 * wimlib is free software; you can redistribute it and/or modify it under the
11 * terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 3 of the License, or (at your option)
15 * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
16 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 * A PARTICULAR PURPOSE. See the GNU General Public License for more
20 * You should have received a copy of the GNU General Public License
21 * along with wimlib; if not, see http://www.gnu.org/licenses/.
28 #include "wimlib/lzx.h"
30 #ifdef USE_LZX_EXTRA_BITS_ARRAY
31 /* LZX uses what it calls 'position slots' to represent match offsets.
32 * What this means is that a small 'position slot' number and a small
33 * offset from that slot are encoded instead of one large offset for
35 * - lzx_position_base is an index to the position slot bases
36 * - lzx_extra_bits states how many bits of offset-from-base data is needed.
38 const u8 lzx_extra_bits[LZX_NUM_POSITION_SLOTS] = {
45 /*14, 14, 15, 15, 16,*/
46 /*16, 17, 17, 17, 17,*/
47 /*17, 17, 17, 17, 17,*/
48 /*17, 17, 17, 17, 17,*/
53 const u32 lzx_position_base[LZX_NUM_POSITION_SLOTS] = {
55 6 , 8 , 12 , 16 , 24 ,
56 32 , 48 , 64 , 96 , 128 ,
57 192 , 256 , 384 , 512 , 768 ,
58 1024 , 1536 , 2048 , 3072 , 4096 ,
59 6144 , 8192 , 12288 , 16384 , 24576 ,
60 /*32768 , 49152 , 65536 , 98304 , 131072 ,*/
61 /*196608 , 262144 , 393216 , 524288 , 655360 ,*/
62 /*786432 , 917504 , 1048576, 1179648, 1310720,*/
63 /*1441792, 1572864, 1703936, 1835008, 1966080,*/