explicitly specify model for relocatable variables PiperOrigin-RevId: 794012728
diff --git a/c/common/constants.c b/c/common/constants.c index 89866b1..ef5a2e2 100644 --- a/c/common/constants.c +++ b/c/common/constants.c
@@ -6,10 +6,10 @@ #include "constants.h" -const BrotliPrefixCodeRange - _kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS] = { - {1, 2}, {5, 2}, {9, 2}, {13, 2}, {17, 3}, {25, 3}, - {33, 3}, {41, 3}, {49, 4}, {65, 4}, {81, 4}, {97, 4}, - {113, 5}, {145, 5}, {177, 5}, {209, 5}, {241, 6}, {305, 6}, - {369, 7}, {497, 8}, {753, 9}, {1265, 10}, {2289, 11}, {4337, 12}, - {8433, 13}, {16625, 24}}; +const BROTLI_MODEL("small") +BrotliPrefixCodeRange _kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS] = { + {1, 2}, {5, 2}, {9, 2}, {13, 2}, {17, 3}, {25, 3}, + {33, 3}, {41, 3}, {49, 4}, {65, 4}, {81, 4}, {97, 4}, + {113, 5}, {145, 5}, {177, 5}, {209, 5}, {241, 6}, {305, 6}, + {369, 7}, {497, 8}, {753, 9}, {1265, 10}, {2289, 11}, {4337, 12}, + {8433, 13}, {16625, 24}};
diff --git a/c/common/constants.h b/c/common/constants.h index 637ad74..85e9802 100644 --- a/c/common/constants.h +++ b/c/common/constants.h
@@ -192,7 +192,7 @@ } BrotliPrefixCodeRange; /* "Soft-private", it is exported, but not "advertised" as API. */ -BROTLI_COMMON_API extern const BrotliPrefixCodeRange - _kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS]; +BROTLI_COMMON_API extern const BROTLI_MODEL("small") +BrotliPrefixCodeRange _kBrotliPrefixCodeRanges[BROTLI_NUM_BLOCK_LEN_SYMBOLS]; #endif /* BROTLI_COMMON_CONSTANTS_H_ */
diff --git a/c/common/context.c b/c/common/context.c index 2a4cd68..d3c910c 100644 --- a/c/common/context.c +++ b/c/common/context.c
@@ -3,7 +3,7 @@ #include "platform.h" /* Common context lookup table for all context modes. */ -const uint8_t _kBrotliContextLookupTable[2048] = { +const BROTLI_MODEL("small") uint8_t _kBrotliContextLookupTable[2048] = { /* CONTEXT_LSB6, last byte. */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
diff --git a/c/common/dictionary.c b/c/common/dictionary.c index 7c015ab..a83306c 100644 --- a/c/common/dictionary.c +++ b/c/common/dictionary.c
@@ -12,7 +12,7 @@ #endif #if !defined(BROTLI_EXTERNAL_DICTIONARY_DATA) -static const uint8_t kBrotliDictionaryData[] = +static const BROTLI_MODEL("small") uint8_t kBrotliDictionaryData[] = /* GENERATED CODE START */ { 116,105,109,101,100,111,119,110,108,105,102,101,108,101,102,116,98,97,99,107,99, @@ -5866,9 +5866,9 @@ #endif /* !BROTLI_EXTERNAL_DICTIONARY_DATA */ #if !defined(BROTLI_EXTERNAL_DICTIONARY_DATA) -static const BrotliDictionary kBrotliDictionary = { +static const BROTLI_MODEL("small") BrotliDictionary kBrotliDictionary = { #else -static BrotliDictionary kBrotliDictionary = { +static BROTLI_MODEL("small") BrotliDictionary kBrotliDictionary = { #endif /* size_bits_by_length */ {
diff --git a/c/common/platform.h b/c/common/platform.h index 056811a..9db12f9 100644 --- a/c/common/platform.h +++ b/c/common/platform.h
@@ -599,4 +599,10 @@ #undef BROTLI_TEST #endif +#if BROTLI_GNUC_HAS_ATTRIBUTE(model, 3, 0, 3) +#define BROTLI_MODEL(M) __attribute__((model(M))) +#else +#define BROTLI_MODEL(M) /* M */ +#endif + #endif /* BROTLI_COMMON_PLATFORM_H_ */
diff --git a/c/common/transform.c b/c/common/transform.c index 49455fc..968b912 100644 --- a/c/common/transform.c +++ b/c/common/transform.c
@@ -4,6 +4,7 @@ See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ +#include "platform.h" #include "transform.h" #if defined(__cplusplus) || defined(c_plusplus) @@ -11,7 +12,7 @@ #endif /* RFC 7932 transforms string data */ -static const char kPrefixSuffix[217] = +static const BROTLI_MODEL("small") char kPrefixSuffix[217] = "\1 \2, \10 of the \4 of \2s \1.\5 and \4 " /* 0x _0 _2 __5 _E _3 _6 _8 _E */ "in \1\"\4 to \2\">\1\n\2. \1]\5 for \3 a \6 " @@ -27,7 +28,7 @@ "t \4ize \2\xc2\xa0\4ous \5 the \2e "; /* \0 - implicit trailing zero. */ /* Cx _2 _7___ ___ _A _F _5 _8 */ -static const uint16_t kPrefixSuffixMap[50] = { +static const BROTLI_MODEL("small") uint16_t kPrefixSuffixMap[50] = { 0x00, 0x02, 0x05, 0x0E, 0x13, 0x16, 0x18, 0x1E, 0x23, 0x25, 0x2A, 0x2D, 0x2F, 0x32, 0x34, 0x3A, 0x3E, 0x45, 0x47, 0x4E, 0x55, 0x5A, 0x5C, 0x63, 0x68, 0x6D, 0x72, 0x77, 0x7A, 0x7C, @@ -36,7 +37,7 @@ }; /* RFC 7932 transforms */ -static const uint8_t kTransformsData[] = { +static const BROTLI_MODEL("small") uint8_t kTransformsData[] = { 49, BROTLI_TRANSFORM_IDENTITY, 49, 49, BROTLI_TRANSFORM_IDENTITY, 0, 0, BROTLI_TRANSFORM_IDENTITY, 0, @@ -160,7 +161,8 @@ 0, BROTLI_TRANSFORM_UPPERCASE_FIRST, 34, }; -static const BrotliTransforms kBrotliTransforms = { +static const BROTLI_MODEL("small") +BrotliTransforms kBrotliTransforms = { sizeof(kPrefixSuffix), (const uint8_t*)kPrefixSuffix, kPrefixSuffixMap,
diff --git a/c/dec/bit_reader.c b/c/dec/bit_reader.c index d4ac6c5..fae034f 100644 --- a/c/dec/bit_reader.c +++ b/c/dec/bit_reader.c
@@ -14,7 +14,8 @@ extern "C" { #endif -const brotli_reg_t kBrotliBitMask[33] = { 0x00000000, +const BROTLI_MODEL("small") +brotli_reg_t kBrotliBitMask[33] = { 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F, 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF,
diff --git a/c/dec/decode.c b/c/dec/decode.c index c266cdf..05f1d37 100644 --- a/c/dec/decode.c +++ b/c/dec/decode.c
@@ -43,16 +43,19 @@ 255 prefix + 32 base + 255 suffix */ static const brotli_reg_t kRingBufferWriteAheadSlack = 542; -static const uint8_t kCodeLengthCodeOrder[BROTLI_CODE_LENGTH_CODES] = { +static const BROTLI_MODEL("small") +uint8_t kCodeLengthCodeOrder[BROTLI_CODE_LENGTH_CODES] = { 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15, }; /* Static prefix code for the complex code length code lengths. */ -static const uint8_t kCodeLengthPrefixLength[16] = { +static const BROTLI_MODEL("small") +uint8_t kCodeLengthPrefixLength[16] = { 2, 2, 2, 3, 2, 2, 2, 4, 2, 2, 2, 3, 2, 2, 2, 4, }; -static const uint8_t kCodeLengthPrefixValue[16] = { +static const BROTLI_MODEL("small") +uint8_t kCodeLengthPrefixValue[16] = { 0, 4, 3, 2, 0, 4, 3, 1, 0, 4, 3, 2, 0, 4, 3, 5, };
diff --git a/c/dec/huffman.c b/c/dec/huffman.c index 5f084a1..06486cf 100644 --- a/c/dec/huffman.c +++ b/c/dec/huffman.c
@@ -22,7 +22,8 @@ ((sizeof(brotli_reg_t) << 3) - BROTLI_REVERSE_BITS_MAX) #else #define BROTLI_REVERSE_BITS_BASE 0 -static uint8_t kReverseBits[1 << BROTLI_REVERSE_BITS_MAX] = { +static BROTLI_MODEL("small") +uint8_t kReverseBits[1 << BROTLI_REVERSE_BITS_MAX] = { 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
diff --git a/c/dec/prefix.h b/c/dec/prefix.h index 78cb402..c7ee74b 100644 --- a/c/dec/prefix.h +++ b/c/dec/prefix.h
@@ -22,7 +22,8 @@ uint16_t copy_len_offset; } CmdLutElement; -static const CmdLutElement kCmdLut[BROTLI_NUM_COMMAND_SYMBOLS] = { +static const BROTLI_MODEL("small") +CmdLutElement kCmdLut[BROTLI_NUM_COMMAND_SYMBOLS] = { { 0x00, 0x00, 0, 0x00, 0x0000, 0x0002 }, { 0x00, 0x00, 0, 0x01, 0x0000, 0x0003 }, { 0x00, 0x00, 0, 0x02, 0x0000, 0x0004 },
diff --git a/c/enc/backward_references_hq.c b/c/enc/backward_references_hq.c index 02ccb88..4320056 100644 --- a/c/enc/backward_references_hq.c +++ b/c/enc/backward_references_hq.c
@@ -32,10 +32,10 @@ static const float kInfinity = 1.7e38f; /* ~= 2 ^ 127 */ -static const uint32_t kDistanceCacheIndex[] = { +static const BROTLI_MODEL("small") uint32_t kDistanceCacheIndex[] = { 0, 1, 2, 3, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, }; -static const int kDistanceCacheOffset[] = { +static const BROTLI_MODEL("small") int kDistanceCacheOffset[] = { 0, 0, 0, 0, -1, 1, -2, 2, -3, 3, -1, 1, -2, 2, -3, 3 };
diff --git a/c/enc/brotli_bit_stream.c b/c/enc/brotli_bit_stream.c index ec0421a..1e9e946 100644 --- a/c/enc/brotli_bit_stream.c +++ b/c/enc/brotli_bit_stream.c
@@ -165,7 +165,8 @@ static void BrotliStoreHuffmanTreeOfHuffmanTreeToBitMask( const int num_codes, const uint8_t* code_length_bitdepth, size_t* storage_ix, uint8_t* storage) { - static const uint8_t kStorageOrder[BROTLI_CODE_LENGTH_CODES] = { + static const BROTLI_MODEL("small") + uint8_t kStorageOrder[BROTLI_CODE_LENGTH_CODES] = { 1, 2, 3, 4, 0, 5, 17, 6, 16, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; /* The bit lengths of the Huffman code over the code length alphabet @@ -178,10 +179,12 @@ 3 01 4 10 5 1111 */ - static const uint8_t kHuffmanBitLengthHuffmanCodeSymbols[6] = { + static const BROTLI_MODEL("small") + uint8_t kHuffmanBitLengthHuffmanCodeSymbols[6] = { 0, 7, 3, 2, 1, 15 }; - static const uint8_t kHuffmanBitLengthHuffmanCodeBitLengths[6] = { + static const BROTLI_MODEL("small") + uint8_t kHuffmanBitLengthHuffmanCodeBitLengths[6] = { 2, 4, 3, 2, 2, 4 };
diff --git a/c/enc/command.h b/c/enc/command.h index ba58f14..c1cb208 100644 --- a/c/enc/command.h +++ b/c/enc/command.h
@@ -19,14 +19,14 @@ extern "C" { #endif -BROTLI_INTERNAL extern const uint32_t - kBrotliInsBase[BROTLI_NUM_INS_COPY_CODES]; -BROTLI_INTERNAL extern const uint32_t - kBrotliInsExtra[BROTLI_NUM_INS_COPY_CODES]; -BROTLI_INTERNAL extern const uint32_t - kBrotliCopyBase[BROTLI_NUM_INS_COPY_CODES]; -BROTLI_INTERNAL extern const uint32_t - kBrotliCopyExtra[BROTLI_NUM_INS_COPY_CODES]; +BROTLI_INTERNAL extern const BROTLI_MODEL("small") +uint32_t kBrotliInsBase[BROTLI_NUM_INS_COPY_CODES]; +BROTLI_INTERNAL extern const BROTLI_MODEL("small") +uint32_t kBrotliInsExtra[BROTLI_NUM_INS_COPY_CODES]; +BROTLI_INTERNAL extern const BROTLI_MODEL("small") +uint32_t kBrotliCopyBase[BROTLI_NUM_INS_COPY_CODES]; +BROTLI_INTERNAL extern const BROTLI_MODEL("small") +uint32_t kBrotliCopyExtra[BROTLI_NUM_INS_COPY_CODES]; static BROTLI_INLINE uint16_t GetInsertLengthCode(size_t insertlen) { if (insertlen < 6) {
diff --git a/c/enc/compress_fragment.c b/c/enc/compress_fragment.c index 1d9ae99..14fec4f 100644 --- a/c/enc/compress_fragment.c +++ b/c/enc/compress_fragment.c
@@ -407,7 +407,7 @@ storage[*storage_ix >> 3] = 0; } -static uint32_t kCmdHistoSeed[128] = { +static BROTLI_MODEL("small") uint32_t kCmdHistoSeed[128] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
diff --git a/c/enc/compress_fragment_two_pass.c b/c/enc/compress_fragment_two_pass.c index 1b7d1b1..cee2f69 100644 --- a/c/enc/compress_fragment_two_pass.c +++ b/c/enc/compress_fragment_two_pass.c
@@ -459,7 +459,7 @@ const uint8_t* literals, const size_t num_literals, const uint32_t* commands, const size_t num_commands, size_t* storage_ix, uint8_t* storage) { - static const uint32_t kNumExtraBits[128] = { + static const BROTLI_MODEL("small") uint32_t kNumExtraBits[128] = { 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 12, 14, 24, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, @@ -469,7 +469,7 @@ 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, }; - static const uint32_t kInsertOffset[24] = { + static const BROTLI_MODEL("small") uint32_t kInsertOffset[24] = { 0, 1, 2, 3, 4, 5, 6, 8, 10, 14, 18, 26, 34, 50, 66, 98, 130, 194, 322, 578, 1090, 2114, 6210, 22594, };
diff --git a/c/enc/dictionary_hash.c b/c/enc/dictionary_hash.c index 7512b65..205c4f9 100644 --- a/c/enc/dictionary_hash.c +++ b/c/enc/dictionary_hash.c
@@ -85,12 +85,15 @@ return BROTLI_TRUE; } +BROTLI_MODEL("small") uint16_t kStaticDictionaryHashWords[BROTLI_ENC_NUM_HASH_BUCKETS]; +BROTLI_MODEL("small") uint8_t kStaticDictionaryHashLengths[BROTLI_ENC_NUM_HASH_BUCKETS]; #else /* BROTLI_STATIC_INIT */ /* GENERATED CODE START */ +const BROTLI_MODEL("small") uint16_t kStaticDictionaryHashWords[BROTLI_ENC_NUM_HASH_BUCKETS] = { 1002,0,0,0,0,0,0,0,0,683,0,0,0,0,0,0,0,1265,0,0,0,0,0,1431,0,0,0,0,0,0,40,0,0,0, 0,155,8,741,0,624,0,0,0,0,0,0,0,0,0,0,0,0,66,503,0,0,0,451,0,0,0,0,0,0,0,835,70, @@ -1075,6 +1078,7 @@ 0,0,0,515,1709,0,0,0,0,0,0,0,0,404,0,0,0,0,500,0,0,0,0,0,0,0,0,0,68,216,0,0,0,0, 0,0,0,488,353,0,0,177,236,0,0,458,490,0,0,0,0,0,0,756,1504,0,757,0,1735,0,0,108, 598,0,0,0,0}; +const BROTLI_MODEL("small") uint8_t kStaticDictionaryHashLengths[BROTLI_ENC_NUM_HASH_BUCKETS] = { 8,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,0,12,0,0,0,0,4,22,5,0, 4,0,0,0,0,0,0,0,0,0,0,0,0,14,6,0,0,0,5,0,0,0,0,0,0,0,7,13,0,0,4,0,0,0,0,0,0,0,0,
diff --git a/c/enc/dictionary_hash.h b/c/enc/dictionary_hash.h index 9cfe1e1..8d08f57 100644 --- a/c/enc/dictionary_hash.h +++ b/c/enc/dictionary_hash.h
@@ -9,10 +9,13 @@ #ifndef BROTLI_ENC_DICTIONARY_HASH_H_ #define BROTLI_ENC_DICTIONARY_HASH_H_ -#include "../common/dictionary.h" #include "../common/platform.h" #include "static_init.h" +#if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) +#include "../common/dictionary.h" +#endif + #if defined(__cplusplus) || defined(c_plusplus) extern "C" { #endif @@ -24,12 +27,16 @@ #if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) BROTLI_BOOL BROTLI_INTERNAL BrotliEncoderInitDictionaryHash( const BrotliDictionary* dictionary, uint16_t* words, uint8_t* lengths); -#endif - -BROTLI_INTERNAL extern uint16_t +BROTLI_INTERNAL extern BROTLI_MODEL("small") uint16_t kStaticDictionaryHashWords[BROTLI_ENC_NUM_HASH_BUCKETS]; -BROTLI_INTERNAL extern uint8_t +BROTLI_INTERNAL extern BROTLI_MODEL("small") uint8_t kStaticDictionaryHashLengths[BROTLI_ENC_NUM_HASH_BUCKETS]; +#else +BROTLI_INTERNAL extern const BROTLI_MODEL("small") uint16_t + kStaticDictionaryHashWords[BROTLI_ENC_NUM_HASH_BUCKETS]; +BROTLI_INTERNAL extern const BROTLI_MODEL("small") uint8_t + kStaticDictionaryHashLengths[BROTLI_ENC_NUM_HASH_BUCKETS]; +#endif #if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */
diff --git a/c/enc/encode.c b/c/enc/encode.c index 0d76f8a..294be2b 100644 --- a/c/enc/encode.c +++ b/c/enc/encode.c
@@ -200,7 +200,7 @@ /* TODO(eustas): move to compress_fragment.c? */ /* Initializes the command and distance prefix codes for the first block. */ static void InitCommandPrefixCodes(BrotliOnePassArena* s) { - static const uint8_t kDefaultCommandDepths[128] = { + static const BROTLI_MODEL("small") uint8_t kDefaultCommandDepths[128] = { 0, 4, 4, 5, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 0, 0, 0, 4, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 10, 10, 10, 10, 10, 10, 0, 4, 4, 5, 5, 5, 6, 6, @@ -210,7 +210,7 @@ 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, }; - static const uint16_t kDefaultCommandBits[128] = { + static const BROTLI_MODEL("small") uint16_t kDefaultCommandBits[128] = { 0, 0, 8, 9, 3, 35, 7, 71, 39, 103, 23, 47, 175, 111, 239, 31, 0, 0, 0, 4, 12, 2, 10, 6, @@ -224,7 +224,7 @@ 2, 10, 6, 21, 13, 29, 3, 19, 11, 15, 47, 31, 95, 63, 127, 255, 767, 2815, 1791, 3839, 511, 2559, 1535, 3583, 1023, 3071, 2047, 4095, }; - static const uint8_t kDefaultCommandCode[] = { + static const BROTLI_MODEL("small") uint8_t kDefaultCommandCode[] = { 0xff, 0x77, 0xd5, 0xbf, 0xe7, 0xde, 0xea, 0x9e, 0x51, 0x5d, 0xde, 0xc6, 0x70, 0x57, 0xbc, 0x58, 0x58, 0x58, 0xd8, 0xd8, 0x58, 0xd5, 0xcb, 0x8c, 0xea, 0xe0, 0xc3, 0x87, 0x1f, 0x83, 0xc1, 0x60, 0x1c, 0x67, 0xb2, 0xaa, @@ -252,13 +252,15 @@ uint32_t* bigram_histo, size_t* num_literal_contexts, const uint32_t** literal_context_map) { - static const uint32_t kStaticContextMapContinuation[64] = { + static const BROTLI_MODEL("small") + uint32_t kStaticContextMapContinuation[64] = { 1, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - static const uint32_t kStaticContextMapSimpleUTF8[64] = { + static const BROTLI_MODEL("small") + uint32_t kStaticContextMapSimpleUTF8[64] = { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -315,7 +317,8 @@ size_t start_pos, size_t length, size_t mask, int quality, size_t size_hint, size_t* num_literal_contexts, const uint32_t** literal_context_map, uint32_t* arena) { - static const uint32_t kStaticContextMapComplexUTF8[64] = { + static const BROTLI_MODEL("small") + uint32_t kStaticContextMapComplexUTF8[64] = { 11, 11, 12, 12, /* 0 special */ 0, 0, 0, 0, /* 4 lf */ 1, 1, 9, 9, /* 8 space */
diff --git a/c/enc/entropy_encode.c b/c/enc/entropy_encode.c index aad2993..1b4eab9 100644 --- a/c/enc/entropy_encode.c +++ b/c/enc/entropy_encode.c
@@ -15,7 +15,7 @@ extern "C" { #endif -const size_t kBrotliShellGaps[] = {132, 57, 23, 10, 4, 1}; +const BROTLI_MODEL("small") size_t kBrotliShellGaps[] = {132, 57, 23, 10, 4, 1}; BROTLI_BOOL BrotliSetDepth( int p0, HuffmanTree* pool, uint8_t* depth, int max_depth) { @@ -452,7 +452,8 @@ } static uint16_t BrotliReverseBits(size_t num_bits, uint16_t bits) { - static const size_t kLut[16] = { /* Pre-reversed 4-bit values. */ + static const size_t BROTLI_MODEL("small") kLut[16] = + { /* Pre-reversed 4-bit values. */ 0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E, 0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F };
diff --git a/c/enc/entropy_encode.h b/c/enc/entropy_encode.h index 7bd3d3b..0470c16 100644 --- a/c/enc/entropy_encode.h +++ b/c/enc/entropy_encode.h
@@ -75,7 +75,7 @@ size_t len, uint16_t* bits); -BROTLI_INTERNAL extern const size_t kBrotliShellGaps[6]; +BROTLI_INTERNAL extern BROTLI_MODEL("small") const size_t kBrotliShellGaps[6]; /* Input size optimized Shell sort. */ typedef BROTLI_BOOL (*HuffmanTreeComparator)( const HuffmanTree*, const HuffmanTree*);
diff --git a/c/enc/entropy_encode_static.h b/c/enc/entropy_encode_static.h index 168b473..5056eaa 100644 --- a/c/enc/entropy_encode_static.h +++ b/c/enc/entropy_encode_static.h
@@ -17,11 +17,12 @@ extern "C" { #endif -static const uint8_t kCodeLengthDepth[18] = { +static const BROTLI_MODEL("small") uint8_t kCodeLengthDepth[18] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 0, 4, 4, }; -static const uint8_t kStaticCommandCodeDepth[BROTLI_NUM_COMMAND_SYMBOLS] = { +static const BROTLI_MODEL("small") +uint8_t kStaticCommandCodeDepth[BROTLI_NUM_COMMAND_SYMBOLS] = { 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, @@ -68,7 +69,8 @@ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, }; -static const uint8_t kStaticDistanceCodeDepth[64] = { +static const BROTLI_MODEL("small") +uint8_t kStaticDistanceCodeDepth[64] = { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, @@ -76,7 +78,8 @@ }; /* GENERATED CODE START */ -static const uint32_t kCodeLengthBits[18] = { +static const BROTLI_MODEL("small") +uint32_t kCodeLengthBits[18] = { 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 15, 31, 0, 11, 7, }; @@ -86,7 +89,8 @@ 40, BROTLI_MAKE_UINT64_T(0x0000FFu, 0x55555554u), storage_ix, storage); } -static const uint64_t kZeroRepsBits[BROTLI_NUM_COMMAND_SYMBOLS] = { +static const BROTLI_MODEL("small") +uint64_t kZeroRepsBits[BROTLI_NUM_COMMAND_SYMBOLS] = { 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00000017, 0x00000027, 0x00000037, 0x00000047, 0x00000057, 0x00000067, 0x00000077, 0x00000770, 0x00000b87, 0x00001387, 0x00001b87, 0x00002387, 0x00002b87, 0x00003387, @@ -207,7 +211,8 @@ 0x06f9cb87, 0x08f9cb87, }; -static const uint32_t kZeroRepsDepth[BROTLI_NUM_COMMAND_SYMBOLS] = { +static const BROTLI_MODEL("small") +uint32_t kZeroRepsDepth[BROTLI_NUM_COMMAND_SYMBOLS] = { 0, 4, 8, 7, 7, 7, 7, 7, 7, 7, 7, 11, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, @@ -254,7 +259,8 @@ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, }; -static const uint64_t kNonZeroRepsBits[BROTLI_NUM_COMMAND_SYMBOLS] = { +static const BROTLI_MODEL("small") +uint64_t kNonZeroRepsBits[BROTLI_NUM_COMMAND_SYMBOLS] = { 0x0000000b, 0x0000001b, 0x0000002b, 0x0000003b, 0x000002cb, 0x000006cb, 0x00000acb, 0x00000ecb, 0x000002db, 0x000006db, 0x00000adb, 0x00000edb, 0x000002eb, 0x000006eb, 0x00000aeb, 0x00000eeb, 0x000002fb, 0x000006fb, @@ -375,7 +381,8 @@ 0x2baeb6db, 0x3baeb6db, }; -static const uint32_t kNonZeroRepsDepth[BROTLI_NUM_COMMAND_SYMBOLS] = { +static const BROTLI_MODEL("small") +uint32_t kNonZeroRepsDepth[BROTLI_NUM_COMMAND_SYMBOLS] = { 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, @@ -422,7 +429,8 @@ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, }; -static const uint16_t kStaticCommandCodeBits[BROTLI_NUM_COMMAND_SYMBOLS] = { +static const BROTLI_MODEL("small") +uint16_t kStaticCommandCodeBits[BROTLI_NUM_COMMAND_SYMBOLS] = { 0, 256, 128, 384, 64, 320, 192, 448, 32, 288, 160, 416, 96, 352, 224, 480, 16, 272, 144, 400, 80, 336, 208, 464, @@ -520,7 +528,7 @@ BrotliWriteBits(3, 0x00000000U, storage_ix, storage); } -static const uint16_t kStaticDistanceCodeBits[64] = { +static const BROTLI_MODEL("small") uint16_t kStaticDistanceCodeBits[64] = { 0, 32, 16, 48, 8, 40, 24, 56, 4, 36, 20, 52, 12, 44, 28, 60, 2, 34, 18, 50, 10, 42, 26, 58, 6, 38, 22, 54, 14, 46, 30, 62, 1, 33, 17, 49, 9, 41, 25, 57, 5, 37, 21, 53, 13, 45, 29, 61,
diff --git a/c/enc/fast_log.c b/c/enc/fast_log.c index 2fa0efc..7b7ac02 100644 --- a/c/enc/fast_log.c +++ b/c/enc/fast_log.c
@@ -11,7 +11,7 @@ #endif /* ", ".join(["%.16ff" % x for x in [0.0]+[log2(x) for x in range(1, 256)]]) */ -const double kBrotliLog2Table[BROTLI_LOG2_TABLE_SIZE] = { +const BROTLI_MODEL("small") double kBrotliLog2Table[BROTLI_LOG2_TABLE_SIZE] = { 0.0000000000000000f, 0.0000000000000000f, 1.0000000000000000f, 1.5849625007211563f, 2.0000000000000000f, 2.3219280948873622f, 2.5849625007211561f, 2.8073549220576042f, 3.0000000000000000f,
diff --git a/c/enc/fast_log.h b/c/enc/fast_log.h index 3a1a3f6..a245443 100644 --- a/c/enc/fast_log.h +++ b/c/enc/fast_log.h
@@ -31,7 +31,8 @@ /* A lookup table for small values of log2(int) to be used in entropy computation. */ -BROTLI_INTERNAL extern const double kBrotliLog2Table[BROTLI_LOG2_TABLE_SIZE]; +BROTLI_INTERNAL extern const BROTLI_MODEL("small") +double kBrotliLog2Table[BROTLI_LOG2_TABLE_SIZE]; /* Visual Studio 2012 and Android API levels < 18 do not have the log2() * function defined, so we use log() and a multiplication instead. */
diff --git a/c/enc/static_dict_lut.c b/c/enc/static_dict_lut.c index 0e40f29..a7c2b7f 100644 --- a/c/enc/static_dict_lut.c +++ b/c/enc/static_dict_lut.c
@@ -204,12 +204,15 @@ return ok; } +BROTLI_MODEL("small") uint16_t kStaticDictionaryBuckets[BROTLI_ENC_STATIC_DICT_LUT_NUM_BUCKETS]; +BROTLI_MODEL("small") DictWord kStaticDictionaryWords[BROTLI_ENC_STATIC_DICT_LUT_NUM_ITEMS]; #else /* BROTLI_STATIC_INIT */ /* GENERATED CODE START */ +const BROTLI_MODEL("small") uint16_t kStaticDictionaryBuckets[BROTLI_ENC_STATIC_DICT_LUT_NUM_BUCKETS] = { 1,0,0,0,0,0,0,0,0,3,6,0,0,0,0,0,20,0,0,0,21,0,22,0,0,0,0,0,0,0,0,23,0,0,25,0,29, 0,53,0,0,0,0,0,0,55,0,0,0,0,0,0,61,76,0,0,0,94,0,0,0,0,0,0,96,0,97,0,98,0,0,0,0, @@ -1485,6 +1488,7 @@ 0,31644,0,31646,0,0,0,0,31648,0,0,0,31652,0,0,0,31657,0,0,31676,0,0,0,0,0,0,0, 31689,31691,31692,0,31694,0,0,0,31696,0,31702,0,31703,0}; +const BROTLI_MODEL("small") DictWord kStaticDictionaryWords[BROTLI_ENC_STATIC_DICT_LUT_NUM_ITEMS] = { {0,0,0},{8,0,1002},{136,0,1015},{4,0,683},{4,10,325},{138,10,125},{7,11,572},{9, 11,592},{11,11,680},{11,11,842},{11,11,924},{12,11,356},{12,11,550},{13,11,317},
diff --git a/c/enc/static_dict_lut.h b/c/enc/static_dict_lut.h index 19f5245..6aa9613 100644 --- a/c/enc/static_dict_lut.h +++ b/c/enc/static_dict_lut.h
@@ -31,12 +31,16 @@ #if (BROTLI_STATIC_INIT != BROTLI_STATIC_INIT_NONE) BROTLI_INTERNAL BROTLI_BOOL BrotliEncoderInitStaticDictionaryLut( const BrotliDictionary* dictionary, uint16_t* buckets, DictWord* words); -#endif - -BROTLI_INTERNAL extern uint16_t +BROTLI_INTERNAL extern BROTLI_MODEL("small") uint16_t kStaticDictionaryBuckets[BROTLI_ENC_STATIC_DICT_LUT_NUM_BUCKETS]; -BROTLI_INTERNAL extern DictWord +BROTLI_INTERNAL extern BROTLI_MODEL("small") DictWord kStaticDictionaryWords[BROTLI_ENC_STATIC_DICT_LUT_NUM_ITEMS]; +#else +BROTLI_INTERNAL extern const BROTLI_MODEL("small") uint16_t + kStaticDictionaryBuckets[BROTLI_ENC_STATIC_DICT_LUT_NUM_BUCKETS]; +BROTLI_INTERNAL extern const BROTLI_MODEL("small") DictWord + kStaticDictionaryWords[BROTLI_ENC_STATIC_DICT_LUT_NUM_ITEMS]; +#endif #if defined(__cplusplus) || defined(c_plusplus) } /* extern "C" */