fix some includes PiperOrigin-RevId: 791063071
diff --git a/c/common/constants.h b/c/common/constants.h index 31e5bd3..637ad74 100644 --- a/c/common/constants.h +++ b/c/common/constants.h
@@ -12,9 +12,6 @@ #ifndef BROTLI_COMMON_CONSTANTS_H_ #define BROTLI_COMMON_CONSTANTS_H_ -#include <brotli/port.h> -#include <brotli/types.h> - #include "platform.h" /* Specification: 7.3. Encoding of the context map */
diff --git a/c/common/context.c b/c/common/context.c index 7f9c958..2a4cd68 100644 --- a/c/common/context.c +++ b/c/common/context.c
@@ -1,6 +1,6 @@ #include "context.h" -#include <brotli/types.h> +#include "platform.h" /* Common context lookup table for all context modes. */ const uint8_t _kBrotliContextLookupTable[2048] = {
diff --git a/c/common/context.h b/c/common/context.h index 685a279..45b57d8 100644 --- a/c/common/context.h +++ b/c/common/context.h
@@ -88,8 +88,7 @@ #ifndef BROTLI_COMMON_CONTEXT_H_ #define BROTLI_COMMON_CONTEXT_H_ -#include <brotli/port.h> -#include <brotli/types.h> +#include "platform.h" typedef enum ContextType { CONTEXT_LSB6 = 0,
diff --git a/c/common/dictionary.h b/c/common/dictionary.h index b1c6f7f..ed683b0 100644 --- a/c/common/dictionary.h +++ b/c/common/dictionary.h
@@ -9,8 +9,7 @@ #ifndef BROTLI_COMMON_DICTIONARY_H_ #define BROTLI_COMMON_DICTIONARY_H_ -#include <brotli/port.h> -#include <brotli/types.h> +#include "platform.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/common/platform.c b/c/common/platform.c index 25d84a9..1e047ce 100644 --- a/c/common/platform.c +++ b/c/common/platform.c
@@ -4,10 +4,6 @@ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ -#include <stdlib.h> - -#include <brotli/types.h> - #include "platform.h" /* Default brotli_alloc_func */
diff --git a/c/common/platform.h b/c/common/platform.h index 713119e..b238218 100644 --- a/c/common/platform.h +++ b/c/common/platform.h
@@ -24,13 +24,13 @@ #ifndef BROTLI_COMMON_PLATFORM_H_ #define BROTLI_COMMON_PLATFORM_H_ -#include <string.h> /* memcpy */ - -#include <brotli/port.h> -#include <brotli/types.h> - +#include <string.h> /* IWYU pragma: export memcmp, memcpy, memset */ +#include <stdlib.h> /* IWYU pragma: export exit, free, malloc */ #include <sys/types.h> /* should include endian.h for us */ +#include <brotli/port.h> /* IWYU pragma: export */ +#include <brotli/types.h> /* IWYU pragma: export */ + #if BROTLI_MSVC_VERSION_CHECK(18, 0, 0) #include <intrin.h> #endif @@ -546,19 +546,36 @@ BROTLI_UNUSED(&BrotliDump); #endif -#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) && !defined(_M_ARM64EC) /* _mm_prefetch() is not defined outside of x86/x64 */ -# include <mmintrin.h> /* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ -# define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) -# define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1) +#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) && \ + !defined(_M_ARM64EC) +/* _mm_prefetch() is not defined outside of x86/x64 */ +/* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */ +#include <mmintrin.h> +#define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0) +#define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1) #elif BROTLI_GNUC_HAS_BUILTIN(__builtin_prefetch, 3, 1, 0) -# define PREFETCH_L1(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) -# define PREFETCH_L2(ptr) __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */) +#define PREFETCH_L1(ptr) \ + __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */) +#define PREFETCH_L2(ptr) \ + __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */) #elif defined(__aarch64__) -# define PREFETCH_L1(ptr) do { __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr))); } while (0) -# define PREFETCH_L2(ptr) do { __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr))); } while (0) +#define PREFETCH_L1(ptr) \ + do { \ + __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr))); \ + } while (0) +#define PREFETCH_L2(ptr) \ + do { \ + __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr))); \ + } while (0) #else -# define PREFETCH_L1(ptr) do { (void)(ptr); } while (0) /* disabled */ -# define PREFETCH_L2(ptr) do { (void)(ptr); } while (0) /* disabled */ +#define PREFETCH_L1(ptr) \ + do { \ + (void)(ptr); \ + } while (0) /* disabled */ +#define PREFETCH_L2(ptr) \ + do { \ + (void)(ptr); \ + } while (0) /* disabled */ #endif /* The SIMD matchers are only faster at certain quality levels. */
diff --git a/c/common/shared_dictionary.c b/c/common/shared_dictionary.c index 49f1c9b..b8ebc68 100644 --- a/c/common/shared_dictionary.c +++ b/c/common/shared_dictionary.c
@@ -8,10 +8,6 @@ #include <brotli/shared_dictionary.h> -#include <memory.h> -#include <stdlib.h> /* malloc, free */ -#include <stdio.h> - #include "dictionary.h" #include "platform.h" #include "shared_dictionary_internal.h"
diff --git a/c/common/shared_dictionary_internal.h b/c/common/shared_dictionary_internal.h index 963762e..c6a90fa 100644 --- a/c/common/shared_dictionary_internal.h +++ b/c/common/shared_dictionary_internal.h
@@ -10,9 +10,9 @@ #define BROTLI_COMMON_SHARED_DICTIONARY_INTERNAL_H_ #include <brotli/shared_dictionary.h> -#include <brotli/types.h> #include "dictionary.h" +#include "platform.h" #include "transform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/common/transform.h b/c/common/transform.h index b6f86cc..c6176d8 100644 --- a/c/common/transform.h +++ b/c/common/transform.h
@@ -8,8 +8,7 @@ #ifndef BROTLI_COMMON_TRANSFORM_H_ #define BROTLI_COMMON_TRANSFORM_H_ -#include <brotli/port.h> -#include <brotli/types.h> +#include "platform.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/dec/bit_reader.c b/c/dec/bit_reader.c index 35101dd..d4ac6c5 100644 --- a/c/dec/bit_reader.c +++ b/c/dec/bit_reader.c
@@ -8,8 +8,6 @@ #include "bit_reader.h" -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/dec/bit_reader.h b/c/dec/bit_reader.h index 930dc60..ef6b047 100644 --- a/c/dec/bit_reader.h +++ b/c/dec/bit_reader.h
@@ -9,10 +9,6 @@ #ifndef BROTLI_DEC_BIT_READER_H_ #define BROTLI_DEC_BIT_READER_H_ -#include <string.h> /* memcpy */ - -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h"
diff --git a/c/dec/decode.c b/c/dec/decode.c index 70d594b..c53cbb8 100644 --- a/c/dec/decode.c +++ b/c/dec/decode.c
@@ -6,9 +6,6 @@ #include <brotli/decode.h> -#include <stdlib.h> /* free, malloc */ -#include <string.h> /* memcpy, memset */ - #include "../common/constants.h" #include "../common/context.h" #include "../common/dictionary.h"
diff --git a/c/dec/huffman.c b/c/dec/huffman.c index 3806454..5f084a1 100644 --- a/c/dec/huffman.c +++ b/c/dec/huffman.c
@@ -8,10 +8,6 @@ #include "huffman.h" -#include <string.h> /* memcpy, memset */ - -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h"
diff --git a/c/dec/huffman.h b/c/dec/huffman.h index 5036096..53daf60 100644 --- a/c/dec/huffman.h +++ b/c/dec/huffman.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_DEC_HUFFMAN_H_ #define BROTLI_DEC_HUFFMAN_H_ -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/dec/prefix.h b/c/dec/prefix.h index e8acf07..78cb402 100644 --- a/c/dec/prefix.h +++ b/c/dec/prefix.h
@@ -10,9 +10,8 @@ #ifndef BROTLI_DEC_PREFIX_H_ #define BROTLI_DEC_PREFIX_H_ -#include <brotli/types.h> - #include "../common/constants.h" +#include "../common/platform.h" typedef struct CmdLutElement { uint8_t insert_len_extra_bits;
diff --git a/c/dec/state.c b/c/dec/state.c index 8b15459..dcf61b9 100644 --- a/c/dec/state.c +++ b/c/dec/state.c
@@ -6,11 +6,8 @@ #include "state.h" -#include <stdlib.h> /* free, malloc */ - -#include <brotli/types.h> - #include "../common/dictionary.h" +#include "../common/platform.h" #include "huffman.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/dec/state.h b/c/dec/state.h index fd250b6..caefef0 100644 --- a/c/dec/state.h +++ b/c/dec/state.h
@@ -11,7 +11,6 @@ #include <brotli/decode.h> #include <brotli/shared_dictionary.h> -#include <brotli/types.h> #include "../common/constants.h" #include "../common/dictionary.h"
diff --git a/c/enc/backward_references.c b/c/enc/backward_references.c index 94fd704..5d1c0ed 100644 --- a/c/enc/backward_references.c +++ b/c/enc/backward_references.c
@@ -8,17 +8,15 @@ #include "backward_references.h" -#include <brotli/types.h> - #include "../common/constants.h" -#include "../common/dictionary.h" +#include "../common/context.h" #include "../common/platform.h" #include "command.h" #include "compound_dictionary.h" -#include "dictionary_hash.h" #include "encoder_dict.h" -#include "memory.h" -#include "quality.h" +#include "hash.h" +#include "params.h" +#include "quality.h" /* IWYU pragma: keep for inc */ #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/backward_references.h b/c/enc/backward_references.h index 20fb98a..17f0c84 100644 --- a/c/enc/backward_references.h +++ b/c/enc/backward_references.h
@@ -9,15 +9,11 @@ #ifndef BROTLI_ENC_BACKWARD_REFERENCES_H_ #define BROTLI_ENC_BACKWARD_REFERENCES_H_ -#include <brotli/types.h> - -#include "../common/constants.h" #include "../common/context.h" -#include "../common/dictionary.h" #include "../common/platform.h" #include "command.h" #include "hash.h" -#include "quality.h" +#include "params.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/backward_references_hq.c b/c/enc/backward_references_hq.c index f8b506e..02ccb88 100644 --- a/c/enc/backward_references_hq.c +++ b/c/enc/backward_references_hq.c
@@ -8,17 +8,15 @@ #include "backward_references_hq.h" -#include <string.h> /* memcpy, memset */ - -#include <brotli/types.h> - #include "../common/constants.h" +#include "../common/context.h" #include "../common/platform.h" #include "command.h" #include "compound_dictionary.h" #include "encoder_dict.h" #include "fast_log.h" #include "find_match_length.h" +#include "hash.h" #include "literal_cost.h" #include "memory.h" #include "params.h"
diff --git a/c/enc/backward_references_hq.h b/c/enc/backward_references_hq.h index 8acf975..4aa2706 100644 --- a/c/enc/backward_references_hq.h +++ b/c/enc/backward_references_hq.h
@@ -9,16 +9,12 @@ #ifndef BROTLI_ENC_BACKWARD_REFERENCES_HQ_H_ #define BROTLI_ENC_BACKWARD_REFERENCES_HQ_H_ -#include <brotli/types.h> - -#include "../common/constants.h" #include "../common/context.h" -#include "../common/dictionary.h" #include "../common/platform.h" #include "command.h" #include "hash.h" #include "memory.h" -#include "quality.h" +#include "params.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/bit_cost.c b/c/enc/bit_cost.c index 6b7c904..e0ba2b0 100644 --- a/c/enc/bit_cost.c +++ b/c/enc/bit_cost.c
@@ -8,12 +8,7 @@ #include "bit_cost.h" -#include <brotli/types.h> - -#include "../common/constants.h" -#include "../common/platform.h" -#include "fast_log.h" -#include "histogram.h" +// #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/bit_cost.h b/c/enc/bit_cost.h index f6f2773..230b533 100644 --- a/c/enc/bit_cost.h +++ b/c/enc/bit_cost.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_ENC_BIT_COST_H_ #define BROTLI_ENC_BIT_COST_H_ -#include <brotli/types.h> - #include "../common/platform.h" #include "fast_log.h" #include "histogram.h"
diff --git a/c/enc/block_splitter.c b/c/enc/block_splitter.c index 5a131f5..470fabb 100644 --- a/c/enc/block_splitter.c +++ b/c/enc/block_splitter.c
@@ -8,8 +8,6 @@ #include "block_splitter.h" -#include <string.h> /* memcpy, memset */ - #include "../common/platform.h" #include "bit_cost.h" #include "cluster.h"
diff --git a/c/enc/block_splitter.h b/c/enc/block_splitter.h index 6046b90..c927794 100644 --- a/c/enc/block_splitter.h +++ b/c/enc/block_splitter.h
@@ -9,12 +9,9 @@ #ifndef BROTLI_ENC_BLOCK_SPLITTER_H_ #define BROTLI_ENC_BLOCK_SPLITTER_H_ -#include <brotli/types.h> - #include "../common/platform.h" #include "command.h" #include "memory.h" -#include "quality.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/brotli_bit_stream.c b/c/enc/brotli_bit_stream.c index 5fa0c69..779c843 100644 --- a/c/enc/brotli_bit_stream.c +++ b/c/enc/brotli_bit_stream.c
@@ -10,10 +10,6 @@ #include "brotli_bit_stream.h" -#include <string.h> /* memcpy, memset */ - -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/context.h" #include "../common/platform.h"
diff --git a/c/enc/brotli_bit_stream.h b/c/enc/brotli_bit_stream.h index a289509..9ca493d 100644 --- a/c/enc/brotli_bit_stream.h +++ b/c/enc/brotli_bit_stream.h
@@ -16,8 +16,6 @@ #ifndef BROTLI_ENC_BROTLI_BIT_STREAM_H_ #define BROTLI_ENC_BROTLI_BIT_STREAM_H_ -#include <brotli/types.h> - #include "../common/context.h" #include "../common/platform.h" #include "command.h"
diff --git a/c/enc/cluster.c b/c/enc/cluster.c index b0faf81..4bf94ab 100644 --- a/c/enc/cluster.c +++ b/c/enc/cluster.c
@@ -8,8 +8,6 @@ #include "cluster.h" -#include <brotli/types.h> - #include "../common/platform.h" #include "bit_cost.h" /* BrotliPopulationCost */ #include "fast_log.h"
diff --git a/c/enc/cluster.h b/c/enc/cluster.h index 013629c..6519116 100644 --- a/c/enc/cluster.h +++ b/c/enc/cluster.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_ENC_CLUSTER_H_ #define BROTLI_ENC_CLUSTER_H_ -#include <brotli/types.h> - #include "../common/platform.h" #include "histogram.h" #include "memory.h"
diff --git a/c/enc/command.c b/c/enc/command.c index bf80561..699fa80 100644 --- a/c/enc/command.c +++ b/c/enc/command.c
@@ -6,7 +6,7 @@ #include "command.h" -#include <brotli/types.h> +#include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/command.h b/c/enc/command.h index ba4de7e..ba58f14 100644 --- a/c/enc/command.h +++ b/c/enc/command.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_ENC_COMMAND_H_ #define BROTLI_ENC_COMMAND_H_ -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h" #include "fast_log.h"
diff --git a/c/enc/compound_dictionary.c b/c/enc/compound_dictionary.c index 59ec864..6a79510 100644 --- a/c/enc/compound_dictionary.c +++ b/c/enc/compound_dictionary.c
@@ -6,11 +6,10 @@ #include "compound_dictionary.h" -#include <brotli/types.h> +#include <brotli/shared_dictionary.h> #include "../common/platform.h" #include "memory.h" -#include "quality.h" static PreparedDictionary* CreatePreparedDictionaryWithParams(MemoryManager* m, const uint8_t* source, size_t source_size, uint32_t bucket_bits,
diff --git a/c/enc/compound_dictionary.h b/c/enc/compound_dictionary.h index 9c531d5..6f5a13a 100644 --- a/c/enc/compound_dictionary.h +++ b/c/enc/compound_dictionary.h
@@ -8,10 +8,8 @@ #define BROTLI_ENC_PREPARED_DICTIONARY_H_ #include <brotli/shared_dictionary.h> -#include <brotli/types.h> #include "../common/platform.h" -#include "../common/constants.h" #include "memory.h" /* "Fat" prepared dictionary, could be cooked outside of C implementation,
diff --git a/c/enc/compress_fragment.c b/c/enc/compress_fragment.c index 7600fc5..1d9ae99 100644 --- a/c/enc/compress_fragment.c +++ b/c/enc/compress_fragment.c
@@ -14,10 +14,7 @@ #include "compress_fragment.h" -#include <string.h> /* memcmp, memcpy, memset */ - -#include <brotli/types.h> - +#include "../common/constants.h" #include "../common/platform.h" #include "brotli_bit_stream.h" #include "entropy_encode.h"
diff --git a/c/enc/compress_fragment.h b/c/enc/compress_fragment.h index 9c0780f..462f366 100644 --- a/c/enc/compress_fragment.h +++ b/c/enc/compress_fragment.h
@@ -12,8 +12,6 @@ #ifndef BROTLI_ENC_COMPRESS_FRAGMENT_H_ #define BROTLI_ENC_COMPRESS_FRAGMENT_H_ -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h" #include "entropy_encode.h"
diff --git a/c/enc/compress_fragment_two_pass.c b/c/enc/compress_fragment_two_pass.c index cca4a19..1b7d1b1 100644 --- a/c/enc/compress_fragment_two_pass.c +++ b/c/enc/compress_fragment_two_pass.c
@@ -12,10 +12,6 @@ #include "compress_fragment_two_pass.h" -#include <string.h> /* memcmp, memcpy, memset */ - -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h" #include "bit_cost.h"
diff --git a/c/enc/compress_fragment_two_pass.h b/c/enc/compress_fragment_two_pass.h index 6d28d9b..e98b5e0 100644 --- a/c/enc/compress_fragment_two_pass.h +++ b/c/enc/compress_fragment_two_pass.h
@@ -13,8 +13,6 @@ #ifndef BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_ #define BROTLI_ENC_COMPRESS_FRAGMENT_TWO_PASS_H_ -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h" #include "entropy_encode.h"
diff --git a/c/enc/dictionary_hash.h b/c/enc/dictionary_hash.h index e553ea5..bbfceed 100644 --- a/c/enc/dictionary_hash.h +++ b/c/enc/dictionary_hash.h
@@ -9,7 +9,7 @@ #ifndef BROTLI_ENC_DICTIONARY_HASH_H_ #define BROTLI_ENC_DICTIONARY_HASH_H_ -#include <brotli/types.h> +#include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/encode.c b/c/enc/encode.c index fb2c0ce..9417d8f 100644 --- a/c/enc/encode.c +++ b/c/enc/encode.c
@@ -8,33 +8,30 @@ #include <brotli/encode.h> #include <brotli/shared_dictionary.h> -#include <brotli/types.h> - -#include <stdlib.h> /* free, malloc */ -#include <string.h> /* memcpy, memset */ #include "../common/constants.h" #include "../common/context.h" #include "../common/platform.h" #include "../common/version.h" -#include "backward_references.h" #include "backward_references_hq.h" +#include "backward_references.h" #include "bit_cost.h" #include "brotli_bit_stream.h" -#include "compress_fragment.h" +#include "command.h" +#include "compound_dictionary.h" #include "compress_fragment_two_pass.h" +#include "compress_fragment.h" #include "dictionary_hash.h" #include "encoder_dict.h" -#include "entropy_encode.h" #include "fast_log.h" #include "hash.h" #include "histogram.h" #include "memory.h" #include "metablock.h" -#include "prefix.h" -#include "state.h" +#include "params.h" #include "quality.h" #include "ringbuffer.h" +#include "state.h" #include "utf8_util.h" #include "write_bits.h"
diff --git a/c/enc/encoder_dict.c b/c/enc/encoder_dict.c index 0984281..26ffda8 100644 --- a/c/enc/encoder_dict.c +++ b/c/enc/encoder_dict.c
@@ -6,7 +6,8 @@ #include "encoder_dict.h" -#include <stdlib.h> /* malloc, free */ +#include <brotli/encode.h> +#include <brotli/shared_dictionary.h> #include "../common/dictionary.h" #include "../common/platform.h" @@ -14,9 +15,11 @@ #include "../common/transform.h" #include "compound_dictionary.h" #include "dictionary_hash.h" +#include "hash_base.h" +#include "hash.h" #include "memory.h" #include "quality.h" -#include "hash.h" +#include "static_dict_lut.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/encoder_dict.h b/c/enc/encoder_dict.h index 81bb942..dcb6aef 100644 --- a/c/enc/encoder_dict.h +++ b/c/enc/encoder_dict.h
@@ -8,7 +8,6 @@ #define BROTLI_ENC_ENCODER_DICT_H_ #include <brotli/shared_dictionary.h> -#include <brotli/types.h> #include "../common/dictionary.h" #include "../common/platform.h"
diff --git a/c/enc/entropy_encode.c b/c/enc/entropy_encode.c index 9aed43b..aad2993 100644 --- a/c/enc/entropy_encode.c +++ b/c/enc/entropy_encode.c
@@ -8,10 +8,6 @@ #include "entropy_encode.h" -#include <string.h> /* memset */ - -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h"
diff --git a/c/enc/entropy_encode.h b/c/enc/entropy_encode.h index e1c779c..7bd3d3b 100644 --- a/c/enc/entropy_encode.h +++ b/c/enc/entropy_encode.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_ENC_ENTROPY_ENCODE_H_ #define BROTLI_ENC_ENTROPY_ENCODE_H_ -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus) @@ -67,7 +65,7 @@ of a Huffman tree. The generated Huffman tree is to be compressed once more using a Huffman tree */ BROTLI_INTERNAL void BrotliWriteHuffmanTree(const uint8_t* depth, - size_t num, + size_t length, size_t* tree_size, uint8_t* tree, uint8_t* extra_bits_data);
diff --git a/c/enc/entropy_encode_static.h b/c/enc/entropy_encode_static.h index ecff1fe..168b473 100644 --- a/c/enc/entropy_encode_static.h +++ b/c/enc/entropy_encode_static.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_ENC_ENTROPY_ENCODE_STATIC_H_ #define BROTLI_ENC_ENTROPY_ENCODE_STATIC_H_ -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h" #include "write_bits.h"
diff --git a/c/enc/fast_log.h b/c/enc/fast_log.h index f82f4cf..3a1a3f6 100644 --- a/c/enc/fast_log.h +++ b/c/enc/fast_log.h
@@ -11,8 +11,6 @@ #include <math.h> -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/enc/find_match_length.h b/c/enc/find_match_length.h index f3de0bd..096be93 100644 --- a/c/enc/find_match_length.h +++ b/c/enc/find_match_length.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_ENC_FIND_MATCH_LENGTH_H_ #define BROTLI_ENC_FIND_MATCH_LENGTH_H_ -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/enc/hash.h b/c/enc/hash.h index 6462263..d86fa18 100644 --- a/c/enc/hash.h +++ b/c/enc/hash.h
@@ -10,11 +10,6 @@ #ifndef BROTLI_ENC_HASH_H_ #define BROTLI_ENC_HASH_H_ -#include <stdlib.h> /* exit */ -#include <string.h> /* memcmp, memset */ - -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/dictionary.h" #include "../common/platform.h" @@ -25,6 +20,7 @@ #include "hash_base.h" #include "matching_tag_mask.h" #include "memory.h" +#include "params.h" #include "quality.h" #include "static_dict.h"
diff --git a/c/enc/hash_base.h b/c/enc/hash_base.h index f10201d..edf1ef0 100644 --- a/c/enc/hash_base.h +++ b/c/enc/hash_base.h
@@ -9,8 +9,6 @@ #ifndef THIRD_PARTY_BROTLI_ENC_HASH_BASE_H_ #define THIRD_PARTY_BROTLI_ENC_HASH_BASE_H_ -#include <brotli/types.h> - #include "../common/platform.h" /* kHashMul32 multiplier has these properties:
diff --git a/c/enc/histogram.c b/c/enc/histogram.c index 4dbb87f..43e4b38 100644 --- a/c/enc/histogram.c +++ b/c/enc/histogram.c
@@ -9,6 +9,7 @@ #include "histogram.h" #include "../common/context.h" +#include "../common/platform.h" #include "block_splitter.h" #include "command.h"
diff --git a/c/enc/histogram.h b/c/enc/histogram.h index d1abd97..a2accc3 100644 --- a/c/enc/histogram.h +++ b/c/enc/histogram.h
@@ -9,10 +9,6 @@ #ifndef BROTLI_ENC_HISTOGRAM_H_ #define BROTLI_ENC_HISTOGRAM_H_ -#include <string.h> /* memset */ - -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/context.h" #include "../common/platform.h"
diff --git a/c/enc/literal_cost.c b/c/enc/literal_cost.c index a129657..c4e207d 100644 --- a/c/enc/literal_cost.c +++ b/c/enc/literal_cost.c
@@ -9,10 +9,6 @@ #include "literal_cost.h" -#include <string.h> /* memset */ - -#include <brotli/types.h> - #include "../common/platform.h" #include "fast_log.h" #include "utf8_util.h"
diff --git a/c/enc/literal_cost.h b/c/enc/literal_cost.h index 284a8e5..eb3f338 100644 --- a/c/enc/literal_cost.h +++ b/c/enc/literal_cost.h
@@ -10,8 +10,6 @@ #ifndef BROTLI_ENC_LITERAL_COST_H_ #define BROTLI_ENC_LITERAL_COST_H_ -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/enc/matching_tag_mask.h b/c/enc/matching_tag_mask.h index c166255..8a1be1d 100644 --- a/c/enc/matching_tag_mask.h +++ b/c/enc/matching_tag_mask.h
@@ -3,7 +3,8 @@ #include "../common/platform.h" -#if defined(__SSE2__) || defined(_M_AMD64) || (defined (_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) +#if defined(__SSE2__) || defined(_M_AMD64) || \ + (defined(_M_IX86) && defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) #define SUPPORTS_SSE_2 #endif
diff --git a/c/enc/memory.c b/c/enc/memory.c index bb5e364..67f81ff 100644 --- a/c/enc/memory.c +++ b/c/enc/memory.c
@@ -9,11 +9,6 @@ #include "memory.h" -#include <stdlib.h> /* exit, free, malloc */ -#include <string.h> /* memcpy */ - -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/enc/memory.h b/c/enc/memory.h index a4417df..d837481 100644 --- a/c/enc/memory.h +++ b/c/enc/memory.h
@@ -9,10 +9,6 @@ #ifndef BROTLI_ENC_MEMORY_H_ #define BROTLI_ENC_MEMORY_H_ -#include <string.h> /* memcpy */ - -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/enc/metablock.c b/c/enc/metablock.c index 5fe43a5..c9bed76 100644 --- a/c/enc/metablock.c +++ b/c/enc/metablock.c
@@ -9,18 +9,18 @@ #include "metablock.h" -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/context.h" #include "../common/platform.h" #include "bit_cost.h" #include "block_splitter.h" #include "cluster.h" +#include "command.h" #include "entropy_encode.h" #include "histogram.h" #include "memory.h" -#include "quality.h" +#include "params.h" +#include "prefix.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/metablock.h b/c/enc/metablock.h index e574bae..e7d1052 100644 --- a/c/enc/metablock.h +++ b/c/enc/metablock.h
@@ -10,15 +10,13 @@ #ifndef BROTLI_ENC_METABLOCK_H_ #define BROTLI_ENC_METABLOCK_H_ -#include <brotli/types.h> - #include "../common/context.h" #include "../common/platform.h" #include "block_splitter.h" #include "command.h" #include "histogram.h" #include "memory.h" -#include "quality.h" +#include "params.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/prefix.h b/c/enc/prefix.h index 0f006f1..24c0afc 100644 --- a/c/enc/prefix.h +++ b/c/enc/prefix.h
@@ -10,8 +10,6 @@ #ifndef BROTLI_ENC_PREFIX_H_ #define BROTLI_ENC_PREFIX_H_ -#include <brotli/types.h> - #include "../common/constants.h" #include "../common/platform.h" #include "fast_log.h"
diff --git a/c/enc/ringbuffer.h b/c/enc/ringbuffer.h index 27245b7..5bb75ed 100644 --- a/c/enc/ringbuffer.h +++ b/c/enc/ringbuffer.h
@@ -9,12 +9,9 @@ #ifndef BROTLI_ENC_RINGBUFFER_H_ #define BROTLI_ENC_RINGBUFFER_H_ -#include <string.h> /* memcpy */ - -#include <brotli/types.h> - #include "../common/platform.h" #include "memory.h" +#include "params.h" #include "quality.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/enc/state.h b/c/enc/state.h index cb82987..325f9f3 100644 --- a/c/enc/state.h +++ b/c/enc/state.h
@@ -9,8 +9,8 @@ #ifndef BROTLI_ENC_STATE_H_ #define BROTLI_ENC_STATE_H_ -#include <brotli/types.h> - +#include "../common/constants.h" +#include "../common/platform.h" #include "command.h" #include "compress_fragment.h" #include "compress_fragment_two_pass.h"
diff --git a/c/enc/static_dict.c b/c/enc/static_dict.c index 1504430..8546746 100644 --- a/c/enc/static_dict.c +++ b/c/enc/static_dict.c
@@ -6,8 +6,6 @@ #include "static_dict.h" -#include <brotli/types.h> - #include "../common/dictionary.h" #include "../common/platform.h" #include "../common/transform.h"
diff --git a/c/enc/static_dict.h b/c/enc/static_dict.h index ab83220..bc69b15 100644 --- a/c/enc/static_dict.h +++ b/c/enc/static_dict.h
@@ -9,10 +9,8 @@ #ifndef BROTLI_ENC_STATIC_DICT_H_ #define BROTLI_ENC_STATIC_DICT_H_ -#include <brotli/types.h> - -#include "../common/dictionary.h" #include "../common/platform.h" + #include "encoder_dict.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/enc/static_dict_lut.h b/c/enc/static_dict_lut.h index 0e4243c..0fef6dd 100644 --- a/c/enc/static_dict_lut.h +++ b/c/enc/static_dict_lut.h
@@ -9,7 +9,7 @@ #ifndef BROTLI_ENC_STATIC_DICT_LUT_H_ #define BROTLI_ENC_STATIC_DICT_LUT_H_ -#include <brotli/types.h> +#include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/utf8_util.c b/c/enc/utf8_util.c index 65ec3f5..d46c364 100644 --- a/c/enc/utf8_util.c +++ b/c/enc/utf8_util.c
@@ -8,7 +8,7 @@ #include "utf8_util.h" -#include <brotli/types.h> +#include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/enc/utf8_util.h b/c/enc/utf8_util.h index a38a953..cae3dba 100644 --- a/c/enc/utf8_util.h +++ b/c/enc/utf8_util.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_ENC_UTF8_UTIL_H_ #define BROTLI_ENC_UTF8_UTIL_H_ -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/enc/write_bits.h b/c/enc/write_bits.h index 242754b..0cdc337 100644 --- a/c/enc/write_bits.h +++ b/c/enc/write_bits.h
@@ -9,8 +9,6 @@ #ifndef BROTLI_ENC_WRITE_BITS_H_ #define BROTLI_ENC_WRITE_BITS_H_ -#include <brotli/types.h> - #include "../common/platform.h" #if defined(__cplusplus) || defined(c_plusplus)
diff --git a/c/include/brotli/decode.h b/c/include/brotli/decode.h index af1aa23..8d436db 100644 --- a/c/include/brotli/decode.h +++ b/c/include/brotli/decode.h
@@ -14,7 +14,7 @@ #include <brotli/port.h> #include <brotli/shared_dictionary.h> -#include <brotli/types.h> +#include <brotli/types.h> /* IWYU pragma: export */ #if defined(__cplusplus) || defined(c_plusplus) extern "C" {
diff --git a/c/include/brotli/encode.h b/c/include/brotli/encode.h index dea9931..6267749 100644 --- a/c/include/brotli/encode.h +++ b/c/include/brotli/encode.h
@@ -14,7 +14,7 @@ #include <brotli/port.h> #include <brotli/shared_dictionary.h> -#include <brotli/types.h> +#include <brotli/types.h> /* IWYU pragma: export */ #if defined(__cplusplus) || defined(c_plusplus) extern "C" {