X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=include%2Fwimlib%2Fdecompress_common.h;h=148b44ef63d0ee5db26509140d13f95f0dbabf87;hb=a06ae552a9774672ceca5850cd861a67223137a0;hp=296d0b1db6455d304e1d053c62131c81e49bc35e;hpb=e6a50e92c221b5c4ce2d86caa1ba2093b20f3ac3;p=wimlib diff --git a/include/wimlib/decompress_common.h b/include/wimlib/decompress_common.h index 296d0b1d..148b44ef 100644 --- a/include/wimlib/decompress_common.h +++ b/include/wimlib/decompress_common.h @@ -10,9 +10,7 @@ #ifndef _WIMLIB_DECOMPRESS_COMMON_H #define _WIMLIB_DECOMPRESS_COMMON_H -#include "wimlib/assert.h" #include "wimlib/compiler.h" -#include "wimlib/endianness.h" #include "wimlib/types.h" #include "wimlib/unaligned.h" @@ -214,8 +212,8 @@ bitstream_align(struct input_bitstream *is) * input data is exhausted, the Huffman symbol is decoded as if the missing bits * are all zeroes. * - * XXX: This is mostly duplicated in lzms_huffman_decode_symbol() in - * lzms-decompress.c. */ + * XXX: This is mostly duplicated in lzms_decode_huffman_symbol() in + * lzms_decompress.c. */ static inline u16 read_huffsym(struct input_bitstream *istream, const u16 decode_table[], unsigned table_bits, unsigned max_codeword_len) @@ -253,6 +251,25 @@ make_huffman_decode_table(u16 decode_table[], unsigned num_syms, unsigned num_bits, const u8 lens[], unsigned max_codeword_len); +static inline void +copy_word_unaligned(const void *src, void *dst) +{ + store_word_unaligned(load_word_unaligned(src), dst); +} + +static inline machine_word_t +repeat_byte(u8 b) +{ + machine_word_t v; + + BUILD_BUG_ON(WORDSIZE != 4 && WORDSIZE != 8); + + v = b; + v |= v << 8; + v |= v << 16; + v |= v << ((WORDSIZE == 8) ? 32 : 0); + return v; +} /* * Copy an LZ77 match at (dst - offset) to dst.