X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=include%2Fwimlib%2Fdecompress_common.h;h=65eb2e4bd79dc906752735e0cfeeb227cdd9fb7f;hp=d20085db61736fdb5b0dfddf1f87619215115525;hb=4a20aae0dd8469a352517a0b107416ffa99ccc55;hpb=8618172276fae088f311923a61bbf26c3d4d8941 diff --git a/include/wimlib/decompress_common.h b/include/wimlib/decompress_common.h index d20085db..65eb2e4b 100644 --- a/include/wimlib/decompress_common.h +++ b/include/wimlib/decompress_common.h @@ -54,7 +54,7 @@ struct input_bitstream { }; /* Initialize a bitstream to read from the specified input buffer. */ -static inline void +static forceinline void init_input_bitstream(struct input_bitstream *is, const void *buffer, u32 size) { is->bitbuf = 0; @@ -73,7 +73,7 @@ init_input_bitstream(struct input_bitstream *is, const void *buffer, u32 size) /* Ensure the bit buffer variable for the bitstream contains at least @num_bits * bits. Following this, bitstream_peek_bits() and/or bitstream_remove_bits() * may be called on the bitstream to peek or remove up to @num_bits bits. */ -static inline void +static forceinline void bitstream_ensure_bits(struct input_bitstream *is, const unsigned num_bits) { /* This currently works for at most 17 bits. */ @@ -106,7 +106,7 @@ overflow: /* Return the next @num_bits bits from the bitstream, without removing them. * There must be at least @num_bits remaining in the buffer variable, from a * previous call to bitstream_ensure_bits(). */ -static inline u32 +static forceinline u32 bitstream_peek_bits(const struct input_bitstream *is, const unsigned num_bits) { return (is->bitbuf >> 1) >> (sizeof(is->bitbuf) * 8 - num_bits - 1); @@ -115,7 +115,7 @@ bitstream_peek_bits(const struct input_bitstream *is, const unsigned num_bits) /* Remove @num_bits from the bitstream. There must be at least @num_bits * remaining in the buffer variable, from a previous call to * bitstream_ensure_bits(). */ -static inline void +static forceinline void bitstream_remove_bits(struct input_bitstream *is, unsigned num_bits) { is->bitbuf <<= num_bits; @@ -125,7 +125,7 @@ bitstream_remove_bits(struct input_bitstream *is, unsigned num_bits) /* Remove and return @num_bits bits from the bitstream. There must be at least * @num_bits remaining in the buffer variable, from a previous call to * bitstream_ensure_bits(). */ -static inline u32 +static forceinline u32 bitstream_pop_bits(struct input_bitstream *is, unsigned num_bits) { u32 bits = bitstream_peek_bits(is, num_bits); @@ -134,7 +134,7 @@ bitstream_pop_bits(struct input_bitstream *is, unsigned num_bits) } /* Read and return the next @num_bits bits from the bitstream. */ -static inline u32 +static forceinline u32 bitstream_read_bits(struct input_bitstream *is, unsigned num_bits) { bitstream_ensure_bits(is, num_bits); @@ -142,7 +142,7 @@ bitstream_read_bits(struct input_bitstream *is, unsigned num_bits) } /* Read and return the next literal byte embedded in the bitstream. */ -static inline u8 +static forceinline u8 bitstream_read_byte(struct input_bitstream *is) { if (unlikely(is->end == is->next)) @@ -151,7 +151,7 @@ bitstream_read_byte(struct input_bitstream *is) } /* Read and return the next 16-bit integer embedded in the bitstream. */ -static inline u16 +static forceinline u16 bitstream_read_u16(struct input_bitstream *is) { u16 v; @@ -164,7 +164,7 @@ bitstream_read_u16(struct input_bitstream *is) } /* Read and return the next 32-bit integer embedded in the bitstream. */ -static inline u32 +static forceinline u32 bitstream_read_u32(struct input_bitstream *is) { u32 v; @@ -178,7 +178,7 @@ bitstream_read_u32(struct input_bitstream *is) /* Read into @dst_buffer an array of literal bytes embedded in the bitstream. * Return 0 if there were enough bytes remaining in the input, otherwise -1. */ -static inline int +static forceinline int bitstream_read_bytes(struct input_bitstream *is, void *dst_buffer, size_t count) { if (unlikely(is->end - is->next < count)) @@ -189,7 +189,7 @@ bitstream_read_bytes(struct input_bitstream *is, void *dst_buffer, size_t count) } /* Align the input bitstream on a coding-unit boundary. */ -static inline void +static forceinline void bitstream_align(struct input_bitstream *is) { is->bitsleft = 0; @@ -242,7 +242,7 @@ bitstream_align(struct input_bitstream *is) * XXX: This is mostly duplicated in lzms_decode_huffman_symbol() in * lzms_decompress.c; keep them in sync! */ -static inline unsigned +static forceinline unsigned read_huffsym(struct input_bitstream *is, const u16 decode_table[], unsigned table_bits, unsigned max_codeword_len) { @@ -414,13 +414,13 @@ make_huffman_decode_table(u16 decode_table[], unsigned num_syms, /* LZ match copying */ /*----------------------------------------------------------------------------*/ -static inline void +static forceinline void copy_word_unaligned(const void *src, void *dst) { store_word_unaligned(load_word_unaligned(src), dst); } -static inline machine_word_t +static forceinline machine_word_t repeat_u16(u16 b) { machine_word_t v = b; @@ -431,7 +431,7 @@ repeat_u16(u16 b) return v; } -static inline machine_word_t +static forceinline machine_word_t repeat_byte(u8 b) { return repeat_u16(((u16)b << 8) | b); @@ -450,7 +450,7 @@ repeat_byte(u8 b) * 'min_length' is a hint which specifies the minimum possible match length. * This should be a compile-time constant. */ -static inline int +static forceinline int lz_copy(u32 length, u32 offset, u8 *out_begin, u8 *out_next, u8 *out_end, u32 min_length) {