#include "wimlib.h"
#include "wimlib/compress.h"
+#include "wimlib/endianness.h"
#include "wimlib/error.h"
#include "wimlib/lzx.h"
#include "wimlib/util.h"
/* Tables for tallying symbol frequencies in the three LZX alphabets */
struct lzx_freqs {
- freq_t main[LZX_MAINCODE_MAX_NUM_SYMBOLS];
- freq_t len[LZX_LENCODE_NUM_SYMBOLS];
- freq_t aligned[LZX_ALIGNEDCODE_NUM_SYMBOLS];
+ input_idx_t main[LZX_MAINCODE_MAX_NUM_SYMBOLS];
+ input_idx_t len[LZX_LENCODE_NUM_SYMBOLS];
+ input_idx_t aligned[LZX_ALIGNEDCODE_NUM_SYMBOLS];
};
/* LZX intermediate match/literal format */
lzx_build_precode(const u8 lens[restrict],
const u8 prev_lens[restrict],
const unsigned num_syms,
- freq_t precode_freqs[restrict LZX_PRECODE_NUM_SYMBOLS],
+ input_idx_t precode_freqs[restrict LZX_PRECODE_NUM_SYMBOLS],
u8 output_syms[restrict num_syms],
u8 precode_lens[restrict LZX_PRECODE_NUM_SYMBOLS],
u16 precode_codewords[restrict LZX_PRECODE_NUM_SYMBOLS],
const u8 prev_lens[restrict],
unsigned num_syms)
{
- freq_t precode_freqs[LZX_PRECODE_NUM_SYMBOLS];
+ input_idx_t precode_freqs[LZX_PRECODE_NUM_SYMBOLS];
u8 output_syms[num_syms];
u8 precode_lens[LZX_PRECODE_NUM_SYMBOLS];
u16 precode_codewords[LZX_PRECODE_NUM_SYMBOLS];
bitstream_put_bits(ostream, 0, 1);
if (max_window_size >= 65536)
- bitstream_put_bits(ostream, (block_size >> 16) & 0xff, 8);
+ bitstream_put_bits(ostream, block_size >> 16, 8);
- bitstream_put_bits(ostream, block_size & 0xffff, 16);
+ bitstream_put_bits(ostream, block_size, 16);
}
/* Write out lengths of the main code. Note that the LZX specification
* aren't worth choosing when using greedy or lazy parsing. */
.min_match = 3,
.max_match = LZX_MAX_MATCH_LEN,
- .max_offset = 32768,
+ .max_offset = LZX_MAX_WINDOW_SIZE,
.good_match = LZX_MAX_MATCH_LEN,
.nice_match = LZX_MAX_MATCH_LEN,
.max_chain_len = LZX_MAX_MATCH_LEN,