Coverage Report

Created: 2025-08-26 06:29

/src/brotli/c/common/platform.h
Line
Count
Source (jump to first uncovered line)
1
/* Copyright 2016 Google Inc. All Rights Reserved.
2
3
   Distributed under MIT license.
4
   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5
*/
6
7
/* Macros for compiler / platform specific features and build options.
8
9
   Build options are:
10
    * BROTLI_BUILD_32_BIT disables 64-bit optimizations
11
    * BROTLI_BUILD_64_BIT forces to use 64-bit optimizations
12
    * BROTLI_BUILD_BIG_ENDIAN forces to use big-endian optimizations
13
    * BROTLI_BUILD_ENDIAN_NEUTRAL disables endian-aware optimizations
14
    * BROTLI_BUILD_LITTLE_ENDIAN forces to use little-endian optimizations
15
    * BROTLI_BUILD_NO_RBIT disables "rbit" optimization for ARM CPUs
16
    * BROTLI_BUILD_NO_UNALIGNED_READ_FAST forces off the fast-unaligned-read
17
      optimizations (mainly for testing purposes)
18
    * BROTLI_DEBUG dumps file name and line number when decoder detects stream
19
      or memory error
20
    * BROTLI_ENABLE_LOG enables asserts and dumps various state information
21
    * BROTLI_ENABLE_DUMP overrides default "dump" behaviour
22
*/
23
24
#ifndef BROTLI_COMMON_PLATFORM_H_
25
#define BROTLI_COMMON_PLATFORM_H_
26
27
#include <string.h>  /* IWYU pragma: export memcmp, memcpy, memset */
28
#include <stdlib.h>  /* IWYU pragma: export exit, free, malloc */
29
#include <sys/types.h>  /* should include endian.h for us */
30
31
#include <brotli/port.h>  /* IWYU pragma: export */
32
#include <brotli/types.h>  /* IWYU pragma: export */
33
34
#if BROTLI_MSVC_VERSION_CHECK(18, 0, 0)
35
#include <intrin.h>
36
#endif
37
38
#if defined(BROTLI_ENABLE_LOG) || defined(BROTLI_DEBUG)
39
#include <assert.h>
40
#include <stdio.h>
41
#endif
42
43
/* The following macros were borrowed from https://github.com/nemequ/hedley
44
 * with permission of original author - Evan Nemerson <evan@nemerson.com> */
45
46
/* >>> >>> >>> hedley macros */
47
48
/* Define "BROTLI_PREDICT_TRUE" and "BROTLI_PREDICT_FALSE" macros for capable
49
   compilers.
50
51
To apply compiler hint, enclose the branching condition into macros, like this:
52
53
  if (BROTLI_PREDICT_TRUE(zero == 0)) {
54
    // main execution path
55
  } else {
56
    // compiler should place this code outside of main execution path
57
  }
58
59
OR:
60
61
  if (BROTLI_PREDICT_FALSE(something_rare_or_unexpected_happens)) {
62
    // compiler should place this code outside of main execution path
63
  }
64
65
*/
66
#if BROTLI_GNUC_HAS_BUILTIN(__builtin_expect, 3, 0, 0) || \
67
    BROTLI_INTEL_VERSION_CHECK(16, 0, 0) ||               \
68
    BROTLI_SUNPRO_VERSION_CHECK(5, 15, 0) ||              \
69
    BROTLI_ARM_VERSION_CHECK(4, 1, 0) ||                  \
70
    BROTLI_IBM_VERSION_CHECK(10, 1, 0) ||                 \
71
    BROTLI_TI_VERSION_CHECK(7, 3, 0) ||                   \
72
    BROTLI_TINYC_VERSION_CHECK(0, 9, 27)
73
2.46G
#define BROTLI_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
74
7.57G
#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
75
#else
76
#define BROTLI_PREDICT_FALSE(x) (x)
77
#define BROTLI_PREDICT_TRUE(x) (x)
78
#endif
79
80
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
81
    !defined(__cplusplus)
82
#define BROTLI_RESTRICT restrict
83
#elif BROTLI_GNUC_VERSION_CHECK(3, 1, 0) ||                         \
84
    BROTLI_MSVC_VERSION_CHECK(14, 0, 0) ||                          \
85
    BROTLI_INTEL_VERSION_CHECK(16, 0, 0) ||                         \
86
    BROTLI_ARM_VERSION_CHECK(4, 1, 0) ||                            \
87
    BROTLI_IBM_VERSION_CHECK(10, 1, 0) ||                           \
88
    BROTLI_PGI_VERSION_CHECK(17, 10, 0) ||                          \
89
    BROTLI_TI_VERSION_CHECK(8, 0, 0) ||                             \
90
    BROTLI_IAR_VERSION_CHECK(8, 0, 0) ||                            \
91
    (BROTLI_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus))
92
#define BROTLI_RESTRICT __restrict
93
#elif BROTLI_SUNPRO_VERSION_CHECK(5, 3, 0) && !defined(__cplusplus)
94
#define BROTLI_RESTRICT _Restrict
95
#else
96
#define BROTLI_RESTRICT
97
#endif
98
99
#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
100
    (defined(__cplusplus) && (__cplusplus >= 199711L))
101
#define BROTLI_MAYBE_INLINE inline
102
#elif defined(__GNUC_STDC_INLINE__) || defined(__GNUC_GNU_INLINE__) || \
103
    BROTLI_ARM_VERSION_CHECK(6, 2, 0)
104
#define BROTLI_MAYBE_INLINE __inline__
105
#elif BROTLI_MSVC_VERSION_CHECK(12, 0, 0) || \
106
    BROTLI_ARM_VERSION_CHECK(4, 1, 0) || BROTLI_TI_VERSION_CHECK(8, 0, 0)
107
#define BROTLI_MAYBE_INLINE __inline
108
#else
109
#define BROTLI_MAYBE_INLINE
110
#endif
111
112
#if BROTLI_GNUC_HAS_ATTRIBUTE(always_inline, 4, 0, 0) ||                       \
113
    BROTLI_INTEL_VERSION_CHECK(16, 0, 0) ||                                    \
114
    BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) ||                                   \
115
    BROTLI_ARM_VERSION_CHECK(4, 1, 0) ||                                       \
116
    BROTLI_IBM_VERSION_CHECK(10, 1, 0) ||                                      \
117
    BROTLI_TI_VERSION_CHECK(8, 0, 0) ||                                        \
118
    (BROTLI_TI_VERSION_CHECK(7, 3, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
119
#define BROTLI_INLINE BROTLI_MAYBE_INLINE __attribute__((__always_inline__))
120
#elif BROTLI_MSVC_VERSION_CHECK(12, 0, 0)
121
#define BROTLI_INLINE BROTLI_MAYBE_INLINE __forceinline
122
#elif BROTLI_TI_VERSION_CHECK(7, 0, 0) && defined(__cplusplus)
123
#define BROTLI_INLINE BROTLI_MAYBE_INLINE _Pragma("FUNC_ALWAYS_INLINE;")
124
#elif BROTLI_IAR_VERSION_CHECK(8, 0, 0)
125
#define BROTLI_INLINE BROTLI_MAYBE_INLINE _Pragma("inline=forced")
126
#else
127
#define BROTLI_INLINE BROTLI_MAYBE_INLINE
128
#endif
129
130
#if BROTLI_GNUC_HAS_ATTRIBUTE(noinline, 4, 0, 0) ||                            \
131
    BROTLI_INTEL_VERSION_CHECK(16, 0, 0) ||                                    \
132
    BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) ||                                   \
133
    BROTLI_ARM_VERSION_CHECK(4, 1, 0) ||                                       \
134
    BROTLI_IBM_VERSION_CHECK(10, 1, 0) ||                                      \
135
    BROTLI_TI_VERSION_CHECK(8, 0, 0) ||                                        \
136
    (BROTLI_TI_VERSION_CHECK(7, 3, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__))
137
#define BROTLI_NOINLINE __attribute__((__noinline__))
138
#elif BROTLI_MSVC_VERSION_CHECK(13, 10, 0)
139
#define BROTLI_NOINLINE __declspec(noinline)
140
#elif BROTLI_PGI_VERSION_CHECK(10, 2, 0)
141
#define BROTLI_NOINLINE _Pragma("noinline")
142
#elif BROTLI_TI_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)
143
#define BROTLI_NOINLINE _Pragma("FUNC_CANNOT_INLINE;")
144
#elif BROTLI_IAR_VERSION_CHECK(8, 0, 0)
145
#define BROTLI_NOINLINE _Pragma("inline=never")
146
#else
147
#define BROTLI_NOINLINE
148
#endif
149
150
/* <<< <<< <<< end of hedley macros. */
151
152
#if BROTLI_GNUC_HAS_ATTRIBUTE(unused, 2, 7, 0) || \
153
    BROTLI_INTEL_VERSION_CHECK(16, 0, 0)
154
#define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE __attribute__ ((unused))
155
#else
156
#define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE
157
#endif
158
159
#if BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0)
160
#define BROTLI_ALIGNED(N) __attribute__((aligned(N)))
161
#else
162
#define BROTLI_ALIGNED(N)
163
#endif
164
165
#if (defined(__ARM_ARCH) && (__ARM_ARCH == 7)) || \
166
    (defined(M_ARM) && (M_ARM == 7))
167
#define BROTLI_TARGET_ARMV7
168
#endif  /* ARMv7 */
169
170
#if (defined(__ARM_ARCH) && (__ARM_ARCH == 8)) || \
171
    defined(__aarch64__) || defined(__ARM64_ARCH_8__)
172
#define BROTLI_TARGET_ARMV8_ANY
173
174
#if defined(__ARM_32BIT_STATE)
175
#define BROTLI_TARGET_ARMV8_32
176
#elif defined(__ARM_64BIT_STATE)
177
#define BROTLI_TARGET_ARMV8_64
178
#endif
179
180
#endif  /* ARMv8 */
181
182
#if defined(__ARM_NEON__) || defined(__ARM_NEON)
183
#define BROTLI_TARGET_NEON
184
#endif
185
186
#if defined(__i386) || defined(_M_IX86)
187
#define BROTLI_TARGET_X86
188
#endif
189
190
#if defined(__x86_64__) || defined(_M_X64)
191
#define BROTLI_TARGET_X64
192
#endif
193
194
#if defined(__PPC64__)
195
#define BROTLI_TARGET_POWERPC64
196
#endif
197
198
#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
199
#define BROTLI_TARGET_RISCV64
200
#endif
201
202
#if defined(__loongarch_lp64)
203
#define BROTLI_TARGET_LOONGARCH64
204
#endif
205
206
#if defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8_64) || \
207
    defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64) || \
208
    defined(BROTLI_TARGET_LOONGARCH64)
209
429M
#define BROTLI_TARGET_64_BITS 1
210
#else
211
#define BROTLI_TARGET_64_BITS 0
212
#endif
213
214
#if defined(BROTLI_BUILD_64_BIT)
215
#define BROTLI_64_BITS 1
216
#elif defined(BROTLI_BUILD_32_BIT)
217
#define BROTLI_64_BITS 0
218
#else
219
214M
#define BROTLI_64_BITS BROTLI_TARGET_64_BITS
220
#endif
221
222
#if (BROTLI_64_BITS)
223
12.1G
#define brotli_reg_t uint64_t
224
#else
225
#define brotli_reg_t uint32_t
226
#endif
227
228
#if defined(BROTLI_BUILD_BIG_ENDIAN)
229
#define BROTLI_BIG_ENDIAN 1
230
#elif defined(BROTLI_BUILD_LITTLE_ENDIAN)
231
#define BROTLI_LITTLE_ENDIAN 1
232
#elif defined(BROTLI_BUILD_ENDIAN_NEUTRAL)
233
/* Just break elif chain. */
234
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
235
#define BROTLI_LITTLE_ENDIAN 1
236
#elif defined(_WIN32) || defined(BROTLI_TARGET_X64)
237
/* Win32 & x64 can currently always be assumed to be little endian */
238
#define BROTLI_LITTLE_ENDIAN 1
239
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
240
#define BROTLI_BIG_ENDIAN 1
241
/* Likely target platform is iOS / OSX. */
242
#elif defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
243
#define BROTLI_LITTLE_ENDIAN 1
244
#elif defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN)
245
#define BROTLI_BIG_ENDIAN 1
246
#endif
247
248
#if !defined(BROTLI_LITTLE_ENDIAN)
249
#define BROTLI_LITTLE_ENDIAN 0
250
#endif
251
252
#if !defined(BROTLI_BIG_ENDIAN)
253
#define BROTLI_BIG_ENDIAN 0
254
#endif
255
256
#if defined(BROTLI_BUILD_NO_UNALIGNED_READ_FAST)
257
#define BROTLI_UNALIGNED_READ_FAST (!!0)
258
#elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) ||       \
259
    defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY) || \
260
    defined(BROTLI_TARGET_RISCV64) || defined(BROTLI_TARGET_LOONGARCH64)
261
/* These targets are known to generate efficient code for unaligned reads
262
 * (e.g. a single instruction, not multiple 1-byte loads, shifted and or'd
263
 * together). */
264
3.53G
#define BROTLI_UNALIGNED_READ_FAST (!!1)
265
#else
266
#define BROTLI_UNALIGNED_READ_FAST (!!0)
267
#endif
268
269
/* Portable unaligned memory access: read / write values via memcpy. */
270
0
static BROTLI_INLINE uint16_t BrotliUnalignedRead16(const void* p) {
271
0
  uint16_t t;
272
0
  memcpy(&t, p, sizeof t);
273
0
  return t;
274
0
}
Unexecuted instantiation: decode.c:BrotliUnalignedRead16
Unexecuted instantiation: huffman.c:BrotliUnalignedRead16
Unexecuted instantiation: state.c:BrotliUnalignedRead16
Unexecuted instantiation: bit_reader.c:BrotliUnalignedRead16
Unexecuted instantiation: constants.c:BrotliUnalignedRead16
Unexecuted instantiation: context.c:BrotliUnalignedRead16
Unexecuted instantiation: platform.c:BrotliUnalignedRead16
Unexecuted instantiation: shared_dictionary.c:BrotliUnalignedRead16
Unexecuted instantiation: transform.c:BrotliUnalignedRead16
Unexecuted instantiation: dictionary.c:BrotliUnalignedRead16
275
98.8k
static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) {
276
98.8k
  uint32_t t;
277
98.8k
  memcpy(&t, p, sizeof t);
278
98.8k
  return t;
279
98.8k
}
decode.c:BrotliUnalignedRead32
Line
Count
Source
275
98.8k
static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) {
276
98.8k
  uint32_t t;
277
98.8k
  memcpy(&t, p, sizeof t);
278
98.8k
  return t;
279
98.8k
}
Unexecuted instantiation: huffman.c:BrotliUnalignedRead32
Unexecuted instantiation: state.c:BrotliUnalignedRead32
Unexecuted instantiation: bit_reader.c:BrotliUnalignedRead32
Unexecuted instantiation: constants.c:BrotliUnalignedRead32
Unexecuted instantiation: context.c:BrotliUnalignedRead32
Unexecuted instantiation: platform.c:BrotliUnalignedRead32
Unexecuted instantiation: shared_dictionary.c:BrotliUnalignedRead32
Unexecuted instantiation: transform.c:BrotliUnalignedRead32
Unexecuted instantiation: dictionary.c:BrotliUnalignedRead32
280
515k
static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {
281
515k
  uint64_t t;
282
515k
  memcpy(&t, p, sizeof t);
283
515k
  return t;
284
515k
}
decode.c:BrotliUnalignedRead64
Line
Count
Source
280
515k
static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {
281
515k
  uint64_t t;
282
515k
  memcpy(&t, p, sizeof t);
283
515k
  return t;
284
515k
}
Unexecuted instantiation: huffman.c:BrotliUnalignedRead64
Unexecuted instantiation: state.c:BrotliUnalignedRead64
Unexecuted instantiation: bit_reader.c:BrotliUnalignedRead64
Unexecuted instantiation: constants.c:BrotliUnalignedRead64
Unexecuted instantiation: context.c:BrotliUnalignedRead64
Unexecuted instantiation: platform.c:BrotliUnalignedRead64
Unexecuted instantiation: shared_dictionary.c:BrotliUnalignedRead64
Unexecuted instantiation: transform.c:BrotliUnalignedRead64
Unexecuted instantiation: dictionary.c:BrotliUnalignedRead64
285
0
static BROTLI_INLINE size_t BrotliUnalignedReadSizeT(const void* p) {
286
0
  size_t t;
287
0
  memcpy(&t, p, sizeof t);
288
0
  return t;
289
0
}
Unexecuted instantiation: decode.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: huffman.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: state.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: bit_reader.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: constants.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: context.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: platform.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: shared_dictionary.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: transform.c:BrotliUnalignedReadSizeT
Unexecuted instantiation: dictionary.c:BrotliUnalignedReadSizeT
290
0
static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {
291
0
  memcpy(p, &v, sizeof v);
292
0
}
Unexecuted instantiation: decode.c:BrotliUnalignedWrite64
Unexecuted instantiation: huffman.c:BrotliUnalignedWrite64
Unexecuted instantiation: state.c:BrotliUnalignedWrite64
Unexecuted instantiation: bit_reader.c:BrotliUnalignedWrite64
Unexecuted instantiation: constants.c:BrotliUnalignedWrite64
Unexecuted instantiation: context.c:BrotliUnalignedWrite64
Unexecuted instantiation: platform.c:BrotliUnalignedWrite64
Unexecuted instantiation: shared_dictionary.c:BrotliUnalignedWrite64
Unexecuted instantiation: transform.c:BrotliUnalignedWrite64
Unexecuted instantiation: dictionary.c:BrotliUnalignedWrite64
293
294
#if BROTLI_LITTLE_ENDIAN
295
/* Straight endianness. Just read / write values. */
296
#define BROTLI_UNALIGNED_LOAD16LE BrotliUnalignedRead16
297
98.8k
#define BROTLI_UNALIGNED_LOAD32LE BrotliUnalignedRead32
298
515k
#define BROTLI_UNALIGNED_LOAD64LE BrotliUnalignedRead64
299
#define BROTLI_UNALIGNED_STORE64LE BrotliUnalignedWrite64
300
#elif BROTLI_BIG_ENDIAN  /* BROTLI_LITTLE_ENDIAN */
301
/* Explain compiler to byte-swap values. */
302
#define BROTLI_BSWAP16_(V) ((uint16_t)( \
303
  (((V) & 0xFFU) << 8) | \
304
  (((V) >> 8) & 0xFFU)))
305
static BROTLI_INLINE uint16_t BROTLI_UNALIGNED_LOAD16LE(const void* p) {
306
  uint16_t value = BrotliUnalignedRead16(p);
307
  return BROTLI_BSWAP16_(value);
308
}
309
#define BROTLI_BSWAP32_(V) ( \
310
  (((V) & 0xFFU) << 24) | (((V) & 0xFF00U) << 8) | \
311
  (((V) >> 8) & 0xFF00U) | (((V) >> 24) & 0xFFU))
312
static BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32LE(const void* p) {
313
  uint32_t value = BrotliUnalignedRead32(p);
314
  return BROTLI_BSWAP32_(value);
315
}
316
#define BROTLI_BSWAP64_(V) ( \
317
  (((V) & 0xFFU) << 56) | (((V) & 0xFF00U) << 40) | \
318
  (((V) & 0xFF0000U) << 24) | (((V) & 0xFF000000U) << 8) | \
319
  (((V) >> 8) & 0xFF000000U) | (((V) >> 24) & 0xFF0000U) | \
320
  (((V) >> 40) & 0xFF00U) | (((V) >> 56) & 0xFFU))
321
static BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void* p) {
322
  uint64_t value = BrotliUnalignedRead64(p);
323
  return BROTLI_BSWAP64_(value);
324
}
325
static BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void* p, uint64_t v) {
326
  uint64_t value = BROTLI_BSWAP64_(v);
327
  BrotliUnalignedWrite64(p, value);
328
}
329
#else  /* BROTLI_LITTLE_ENDIAN */
330
/* Read / store values byte-wise; hopefully compiler will understand. */
331
static BROTLI_INLINE uint16_t BROTLI_UNALIGNED_LOAD16LE(const void* p) {
332
  const uint8_t* in = (const uint8_t*)p;
333
  return (uint16_t)(in[0] | (in[1] << 8));
334
}
335
static BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32LE(const void* p) {
336
  const uint8_t* in = (const uint8_t*)p;
337
  uint32_t value = (uint32_t)(in[0]);
338
  value |= (uint32_t)(in[1]) << 8;
339
  value |= (uint32_t)(in[2]) << 16;
340
  value |= (uint32_t)(in[3]) << 24;
341
  return value;
342
}
343
static BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void* p) {
344
  const uint8_t* in = (const uint8_t*)p;
345
  uint64_t value = (uint64_t)(in[0]);
346
  value |= (uint64_t)(in[1]) << 8;
347
  value |= (uint64_t)(in[2]) << 16;
348
  value |= (uint64_t)(in[3]) << 24;
349
  value |= (uint64_t)(in[4]) << 32;
350
  value |= (uint64_t)(in[5]) << 40;
351
  value |= (uint64_t)(in[6]) << 48;
352
  value |= (uint64_t)(in[7]) << 56;
353
  return value;
354
}
355
static BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void* p, uint64_t v) {
356
  uint8_t* out = (uint8_t*)p;
357
  out[0] = (uint8_t)v;
358
  out[1] = (uint8_t)(v >> 8);
359
  out[2] = (uint8_t)(v >> 16);
360
  out[3] = (uint8_t)(v >> 24);
361
  out[4] = (uint8_t)(v >> 32);
362
  out[5] = (uint8_t)(v >> 40);
363
  out[6] = (uint8_t)(v >> 48);
364
  out[7] = (uint8_t)(v >> 56);
365
}
366
#endif  /* BROTLI_LITTLE_ENDIAN */
367
368
0
static BROTLI_INLINE void* BROTLI_UNALIGNED_LOAD_PTR(const void* p) {
369
0
  void* v;
370
0
  memcpy(&v, p, sizeof(void*));
371
0
  return v;
372
0
}
Unexecuted instantiation: decode.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: huffman.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: state.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: bit_reader.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: constants.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: context.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: platform.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: shared_dictionary.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: transform.c:BROTLI_UNALIGNED_LOAD_PTR
Unexecuted instantiation: dictionary.c:BROTLI_UNALIGNED_LOAD_PTR
373
374
0
static BROTLI_INLINE void BROTLI_UNALIGNED_STORE_PTR(void* p, const void* v) {
375
0
  memcpy(p, &v, sizeof(void*));
376
0
}
Unexecuted instantiation: decode.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: huffman.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: state.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: bit_reader.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: constants.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: context.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: platform.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: shared_dictionary.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: transform.c:BROTLI_UNALIGNED_STORE_PTR
Unexecuted instantiation: dictionary.c:BROTLI_UNALIGNED_STORE_PTR
377
378
/* BROTLI_IS_CONSTANT macros returns true for compile-time constants. */
379
#if BROTLI_GNUC_HAS_BUILTIN(__builtin_constant_p, 3, 0, 1) || \
380
    BROTLI_INTEL_VERSION_CHECK(16, 0, 0)
381
7.87G
#define BROTLI_IS_CONSTANT(x) (!!__builtin_constant_p(x))
382
#else
383
#define BROTLI_IS_CONSTANT(x) (!!0)
384
#endif
385
386
#if defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY)
387
#define BROTLI_HAS_UBFX (!!1)
388
#else
389
278M
#define BROTLI_HAS_UBFX (!!0)
390
#endif
391
392
#if defined(BROTLI_ENABLE_LOG)
393
#define BROTLI_LOG(x) printf x
394
#else
395
#define BROTLI_LOG(x)
396
#endif
397
398
#if defined(BROTLI_DEBUG) || defined(BROTLI_ENABLE_LOG)
399
#define BROTLI_ENABLE_DUMP_DEFAULT 1
400
#define BROTLI_DCHECK(x) assert(x)
401
#else
402
#define BROTLI_ENABLE_DUMP_DEFAULT 0
403
#define BROTLI_DCHECK(x)
404
#endif
405
406
#if !defined(BROTLI_ENABLE_DUMP)
407
#define BROTLI_ENABLE_DUMP BROTLI_ENABLE_DUMP_DEFAULT
408
#endif
409
410
#if BROTLI_ENABLE_DUMP
411
static BROTLI_INLINE void BrotliDump(const char* f, int l, const char* fn) {
412
  fprintf(stderr, "%s:%d (%s)\n", f, l, fn);
413
  fflush(stderr);
414
}
415
#define BROTLI_DUMP() BrotliDump(__FILE__, __LINE__, __FUNCTION__)
416
#else
417
1.78k
#define BROTLI_DUMP() (void)(0)
418
#endif
419
420
/* BrotliRBit assumes brotli_reg_t fits native CPU register type. */
421
#if (BROTLI_64_BITS == BROTLI_TARGET_64_BITS)
422
/* TODO(eustas): add appropriate icc/sunpro/arm/ibm/ti checks. */
423
#if (BROTLI_GNUC_VERSION_CHECK(3, 0, 0) || defined(__llvm__)) && \
424
    !defined(BROTLI_BUILD_NO_RBIT)
425
#if defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY)
426
/* TODO(eustas): detect ARMv6T2 and enable this code for it. */
427
static BROTLI_INLINE brotli_reg_t BrotliRBit(brotli_reg_t input) {
428
  brotli_reg_t output;
429
  __asm__("rbit %0, %1\n" : "=r"(output) : "r"(input));
430
  return output;
431
}
432
#define BROTLI_RBIT(x) BrotliRBit(x)
433
#endif  /* armv7 / armv8 */
434
#endif  /* gcc || clang */
435
#endif  /* brotli_reg_t is native */
436
#if !defined(BROTLI_RBIT)
437
0
static BROTLI_INLINE void BrotliRBit(void) { /* Should break build if used. */ }
Unexecuted instantiation: decode.c:BrotliRBit
Unexecuted instantiation: huffman.c:BrotliRBit
Unexecuted instantiation: state.c:BrotliRBit
Unexecuted instantiation: bit_reader.c:BrotliRBit
Unexecuted instantiation: constants.c:BrotliRBit
Unexecuted instantiation: context.c:BrotliRBit
Unexecuted instantiation: platform.c:BrotliRBit
Unexecuted instantiation: shared_dictionary.c:BrotliRBit
Unexecuted instantiation: transform.c:BrotliRBit
Unexecuted instantiation: dictionary.c:BrotliRBit
438
#endif  /* BROTLI_RBIT */
439
440
381k
#define BROTLI_REPEAT_4(X) {X; X; X; X;}
441
9.88k
#define BROTLI_REPEAT_5(X) {X; X; X; X; X;}
442
29.6k
#define BROTLI_REPEAT_6(X) {X; X; X; X; X; X;}
443
444
475k
#define BROTLI_UNUSED(X) (void)(X)
445
446
#define BROTLI_MIN_MAX(T)                                                      \
447
0
  static BROTLI_INLINE T brotli_min_ ## T (T a, T b) { return a < b ? a : b; } \
Unexecuted instantiation: decode.c:brotli_min_double
Unexecuted instantiation: decode.c:brotli_min_float
Unexecuted instantiation: decode.c:brotli_min_int
Unexecuted instantiation: decode.c:brotli_min_size_t
Unexecuted instantiation: decode.c:brotli_min_uint32_t
Unexecuted instantiation: decode.c:brotli_min_uint8_t
Unexecuted instantiation: huffman.c:brotli_min_double
Unexecuted instantiation: huffman.c:brotli_min_float
Unexecuted instantiation: huffman.c:brotli_min_int
Unexecuted instantiation: huffman.c:brotli_min_size_t
Unexecuted instantiation: huffman.c:brotli_min_uint32_t
Unexecuted instantiation: huffman.c:brotli_min_uint8_t
Unexecuted instantiation: state.c:brotli_min_double
Unexecuted instantiation: state.c:brotli_min_float
Unexecuted instantiation: state.c:brotli_min_int
Unexecuted instantiation: state.c:brotli_min_size_t
Unexecuted instantiation: state.c:brotli_min_uint32_t
Unexecuted instantiation: state.c:brotli_min_uint8_t
Unexecuted instantiation: bit_reader.c:brotli_min_double
Unexecuted instantiation: bit_reader.c:brotli_min_float
Unexecuted instantiation: bit_reader.c:brotli_min_int
Unexecuted instantiation: bit_reader.c:brotli_min_size_t
Unexecuted instantiation: bit_reader.c:brotli_min_uint32_t
Unexecuted instantiation: bit_reader.c:brotli_min_uint8_t
Unexecuted instantiation: constants.c:brotli_min_double
Unexecuted instantiation: constants.c:brotli_min_float
Unexecuted instantiation: constants.c:brotli_min_int
Unexecuted instantiation: constants.c:brotli_min_size_t
Unexecuted instantiation: constants.c:brotli_min_uint32_t
Unexecuted instantiation: constants.c:brotli_min_uint8_t
Unexecuted instantiation: context.c:brotli_min_double
Unexecuted instantiation: context.c:brotli_min_float
Unexecuted instantiation: context.c:brotli_min_int
Unexecuted instantiation: context.c:brotli_min_size_t
Unexecuted instantiation: context.c:brotli_min_uint32_t
Unexecuted instantiation: context.c:brotli_min_uint8_t
Unexecuted instantiation: platform.c:brotli_min_double
Unexecuted instantiation: platform.c:brotli_min_float
Unexecuted instantiation: platform.c:brotli_min_int
Unexecuted instantiation: platform.c:brotli_min_size_t
Unexecuted instantiation: platform.c:brotli_min_uint32_t
Unexecuted instantiation: platform.c:brotli_min_uint8_t
Unexecuted instantiation: shared_dictionary.c:brotli_min_double
Unexecuted instantiation: shared_dictionary.c:brotli_min_float
Unexecuted instantiation: shared_dictionary.c:brotli_min_int
Unexecuted instantiation: shared_dictionary.c:brotli_min_size_t
Unexecuted instantiation: shared_dictionary.c:brotli_min_uint32_t
Unexecuted instantiation: shared_dictionary.c:brotli_min_uint8_t
Unexecuted instantiation: transform.c:brotli_min_double
Unexecuted instantiation: transform.c:brotli_min_float
Unexecuted instantiation: transform.c:brotli_min_int
Unexecuted instantiation: transform.c:brotli_min_size_t
Unexecuted instantiation: transform.c:brotli_min_uint32_t
Unexecuted instantiation: transform.c:brotli_min_uint8_t
Unexecuted instantiation: dictionary.c:brotli_min_double
Unexecuted instantiation: dictionary.c:brotli_min_float
Unexecuted instantiation: dictionary.c:brotli_min_int
Unexecuted instantiation: dictionary.c:brotli_min_size_t
Unexecuted instantiation: dictionary.c:brotli_min_uint32_t
Unexecuted instantiation: dictionary.c:brotli_min_uint8_t
448
0
  static BROTLI_INLINE T brotli_max_ ## T (T a, T b) { return a > b ? a : b; }
Unexecuted instantiation: decode.c:brotli_max_double
Unexecuted instantiation: decode.c:brotli_max_float
Unexecuted instantiation: decode.c:brotli_max_int
Unexecuted instantiation: decode.c:brotli_max_size_t
Unexecuted instantiation: decode.c:brotli_max_uint32_t
Unexecuted instantiation: decode.c:brotli_max_uint8_t
Unexecuted instantiation: huffman.c:brotli_max_double
Unexecuted instantiation: huffman.c:brotli_max_float
Unexecuted instantiation: huffman.c:brotli_max_int
Unexecuted instantiation: huffman.c:brotli_max_size_t
Unexecuted instantiation: huffman.c:brotli_max_uint32_t
Unexecuted instantiation: huffman.c:brotli_max_uint8_t
Unexecuted instantiation: state.c:brotli_max_double
Unexecuted instantiation: state.c:brotli_max_float
Unexecuted instantiation: state.c:brotli_max_int
Unexecuted instantiation: state.c:brotli_max_size_t
Unexecuted instantiation: state.c:brotli_max_uint32_t
Unexecuted instantiation: state.c:brotli_max_uint8_t
Unexecuted instantiation: bit_reader.c:brotli_max_double
Unexecuted instantiation: bit_reader.c:brotli_max_float
Unexecuted instantiation: bit_reader.c:brotli_max_int
Unexecuted instantiation: bit_reader.c:brotli_max_size_t
Unexecuted instantiation: bit_reader.c:brotli_max_uint32_t
Unexecuted instantiation: bit_reader.c:brotli_max_uint8_t
Unexecuted instantiation: constants.c:brotli_max_double
Unexecuted instantiation: constants.c:brotli_max_float
Unexecuted instantiation: constants.c:brotli_max_int
Unexecuted instantiation: constants.c:brotli_max_size_t
Unexecuted instantiation: constants.c:brotli_max_uint32_t
Unexecuted instantiation: constants.c:brotli_max_uint8_t
Unexecuted instantiation: context.c:brotli_max_double
Unexecuted instantiation: context.c:brotli_max_float
Unexecuted instantiation: context.c:brotli_max_int
Unexecuted instantiation: context.c:brotli_max_size_t
Unexecuted instantiation: context.c:brotli_max_uint32_t
Unexecuted instantiation: context.c:brotli_max_uint8_t
Unexecuted instantiation: platform.c:brotli_max_double
Unexecuted instantiation: platform.c:brotli_max_float
Unexecuted instantiation: platform.c:brotli_max_int
Unexecuted instantiation: platform.c:brotli_max_size_t
Unexecuted instantiation: platform.c:brotli_max_uint32_t
Unexecuted instantiation: platform.c:brotli_max_uint8_t
Unexecuted instantiation: shared_dictionary.c:brotli_max_double
Unexecuted instantiation: shared_dictionary.c:brotli_max_float
Unexecuted instantiation: shared_dictionary.c:brotli_max_int
Unexecuted instantiation: shared_dictionary.c:brotli_max_size_t
Unexecuted instantiation: shared_dictionary.c:brotli_max_uint32_t
Unexecuted instantiation: shared_dictionary.c:brotli_max_uint8_t
Unexecuted instantiation: transform.c:brotli_max_double
Unexecuted instantiation: transform.c:brotli_max_float
Unexecuted instantiation: transform.c:brotli_max_int
Unexecuted instantiation: transform.c:brotli_max_size_t
Unexecuted instantiation: transform.c:brotli_max_uint32_t
Unexecuted instantiation: transform.c:brotli_max_uint8_t
Unexecuted instantiation: dictionary.c:brotli_max_double
Unexecuted instantiation: dictionary.c:brotli_max_float
Unexecuted instantiation: dictionary.c:brotli_max_int
Unexecuted instantiation: dictionary.c:brotli_max_size_t
Unexecuted instantiation: dictionary.c:brotli_max_uint32_t
Unexecuted instantiation: dictionary.c:brotli_max_uint8_t
449
BROTLI_MIN_MAX(double) BROTLI_MIN_MAX(float) BROTLI_MIN_MAX(int)
450
BROTLI_MIN_MAX(size_t) BROTLI_MIN_MAX(uint32_t) BROTLI_MIN_MAX(uint8_t)
451
#undef BROTLI_MIN_MAX
452
#define BROTLI_MIN(T, A, B) (brotli_min_ ## T((A), (B)))
453
#define BROTLI_MAX(T, A, B) (brotli_max_ ## T((A), (B)))
454
455
#define BROTLI_SWAP(T, A, I, J) { \
456
  T __brotli_swap_tmp = (A)[(I)]; \
457
  (A)[(I)] = (A)[(J)];            \
458
  (A)[(J)] = __brotli_swap_tmp;   \
459
}
460
461
#if BROTLI_64_BITS
462
#if BROTLI_GNUC_HAS_BUILTIN(__builtin_ctzll, 3, 4, 0) || \
463
    BROTLI_INTEL_VERSION_CHECK(16, 0, 0)
464
#define BROTLI_TZCNT64 __builtin_ctzll
465
#elif BROTLI_MSVC_VERSION_CHECK(18, 0, 0)
466
#if defined(BROTLI_TARGET_X64) && !defined(_M_ARM64EC)
467
#define BROTLI_TZCNT64 _tzcnt_u64
468
#else /* BROTLI_TARGET_X64 */
469
static BROTLI_INLINE uint32_t BrotliBsf64Msvc(uint64_t x) {
470
  uint32_t lsb;
471
  _BitScanForward64(&lsb, x);
472
  return lsb;
473
}
474
#define BROTLI_TZCNT64 BrotliBsf64Msvc
475
#endif /* BROTLI_TARGET_X64 */
476
#endif /* __builtin_ctzll */
477
#endif /* BROTLI_64_BITS */
478
479
#if BROTLI_GNUC_HAS_BUILTIN(__builtin_clz, 3, 4, 0) || \
480
    BROTLI_INTEL_VERSION_CHECK(16, 0, 0)
481
#define BROTLI_BSR32(x) (31u ^ (uint32_t)__builtin_clz(x))
482
#elif BROTLI_MSVC_VERSION_CHECK(18, 0, 0)
483
static BROTLI_INLINE uint32_t BrotliBsr32Msvc(uint32_t x) {
484
  unsigned long msb;
485
  _BitScanReverse(&msb, x);
486
  return (uint32_t)msb;
487
}
488
#define BROTLI_BSR32 BrotliBsr32Msvc
489
#endif /* __builtin_clz */
490
491
/* Default brotli_alloc_func */
492
BROTLI_COMMON_API void* BrotliDefaultAllocFunc(void* opaque, size_t size);
493
494
/* Default brotli_free_func */
495
BROTLI_COMMON_API void BrotliDefaultFreeFunc(void* opaque, void* address);
496
497
/* Circular logical rotates. */
498
static BROTLI_INLINE uint16_t BrotliRotateRight16(uint16_t const value,
499
0
                                             size_t count) {
500
0
  count &= 0x0F; /* for fickle pattern recognition */
501
0
  return (value >> count) | (uint16_t)(value << ((0U - count) & 0x0F));
502
0
}
Unexecuted instantiation: decode.c:BrotliRotateRight16
Unexecuted instantiation: huffman.c:BrotliRotateRight16
Unexecuted instantiation: state.c:BrotliRotateRight16
Unexecuted instantiation: bit_reader.c:BrotliRotateRight16
Unexecuted instantiation: constants.c:BrotliRotateRight16
Unexecuted instantiation: context.c:BrotliRotateRight16
Unexecuted instantiation: platform.c:BrotliRotateRight16
Unexecuted instantiation: shared_dictionary.c:BrotliRotateRight16
Unexecuted instantiation: transform.c:BrotliRotateRight16
Unexecuted instantiation: dictionary.c:BrotliRotateRight16
503
static BROTLI_INLINE uint32_t BrotliRotateRight32(uint32_t const value,
504
0
                                             size_t count) {
505
0
  count &= 0x1F; /* for fickle pattern recognition */
506
0
  return (value >> count) | (uint32_t)(value << ((0U - count) & 0x1F));
507
0
}
Unexecuted instantiation: decode.c:BrotliRotateRight32
Unexecuted instantiation: huffman.c:BrotliRotateRight32
Unexecuted instantiation: state.c:BrotliRotateRight32
Unexecuted instantiation: bit_reader.c:BrotliRotateRight32
Unexecuted instantiation: constants.c:BrotliRotateRight32
Unexecuted instantiation: context.c:BrotliRotateRight32
Unexecuted instantiation: platform.c:BrotliRotateRight32
Unexecuted instantiation: shared_dictionary.c:BrotliRotateRight32
Unexecuted instantiation: transform.c:BrotliRotateRight32
Unexecuted instantiation: dictionary.c:BrotliRotateRight32
508
static BROTLI_INLINE uint64_t BrotliRotateRight64(uint64_t const value,
509
0
                                             size_t count) {
510
0
  count &= 0x3F; /* for fickle pattern recognition */
511
0
  return (value >> count) | (uint64_t)(value << ((0U - count) & 0x3F));
512
0
}
Unexecuted instantiation: decode.c:BrotliRotateRight64
Unexecuted instantiation: huffman.c:BrotliRotateRight64
Unexecuted instantiation: state.c:BrotliRotateRight64
Unexecuted instantiation: bit_reader.c:BrotliRotateRight64
Unexecuted instantiation: constants.c:BrotliRotateRight64
Unexecuted instantiation: context.c:BrotliRotateRight64
Unexecuted instantiation: platform.c:BrotliRotateRight64
Unexecuted instantiation: shared_dictionary.c:BrotliRotateRight64
Unexecuted instantiation: transform.c:BrotliRotateRight64
Unexecuted instantiation: dictionary.c:BrotliRotateRight64
513
514
0
BROTLI_UNUSED_FUNCTION void BrotliSuppressUnusedFunctions(void) {
515
0
  BROTLI_UNUSED(&BrotliSuppressUnusedFunctions);
516
0
  BROTLI_UNUSED(&BrotliUnalignedRead16);
517
0
  BROTLI_UNUSED(&BrotliUnalignedRead32);
518
0
  BROTLI_UNUSED(&BrotliUnalignedRead64);
519
0
  BROTLI_UNUSED(&BrotliUnalignedReadSizeT);
520
0
  BROTLI_UNUSED(&BrotliUnalignedWrite64);
521
0
  BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD16LE);
522
0
  BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD32LE);
523
0
  BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD64LE);
524
0
  BROTLI_UNUSED(&BROTLI_UNALIGNED_STORE64LE);
525
0
  BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD_PTR);
526
0
  BROTLI_UNUSED(&BROTLI_UNALIGNED_STORE_PTR);
527
0
  BROTLI_UNUSED(&BrotliRBit);
528
0
  BROTLI_UNUSED(&brotli_min_double);
529
0
  BROTLI_UNUSED(&brotli_max_double);
530
0
  BROTLI_UNUSED(&brotli_min_float);
531
0
  BROTLI_UNUSED(&brotli_max_float);
532
0
  BROTLI_UNUSED(&brotli_min_int);
533
0
  BROTLI_UNUSED(&brotli_max_int);
534
0
  BROTLI_UNUSED(&brotli_min_size_t);
535
0
  BROTLI_UNUSED(&brotli_max_size_t);
536
0
  BROTLI_UNUSED(&brotli_min_uint32_t);
537
0
  BROTLI_UNUSED(&brotli_max_uint32_t);
538
0
  BROTLI_UNUSED(&brotli_min_uint8_t);
539
0
  BROTLI_UNUSED(&brotli_max_uint8_t);
540
0
  BROTLI_UNUSED(&BrotliDefaultAllocFunc);
541
0
  BROTLI_UNUSED(&BrotliDefaultFreeFunc);
542
0
  BROTLI_UNUSED(&BrotliRotateRight16);
543
0
  BROTLI_UNUSED(&BrotliRotateRight32);
544
0
  BROTLI_UNUSED(&BrotliRotateRight64);
545
0
#if BROTLI_ENABLE_DUMP
546
0
  BROTLI_UNUSED(&BrotliDump);
547
0
#endif
548
0
549
0
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_I86)) && \
550
0
    !defined(_M_ARM64EC)
551
0
/* _mm_prefetch() is not defined outside of x86/x64 */
552
0
/* https://msdn.microsoft.com/fr-fr/library/84szxsww(v=vs.90).aspx */
553
0
#include <mmintrin.h>
554
0
#define PREFETCH_L1(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T0)
555
0
#define PREFETCH_L2(ptr) _mm_prefetch((const char*)(ptr), _MM_HINT_T1)
556
0
#elif BROTLI_GNUC_HAS_BUILTIN(__builtin_prefetch, 3, 1, 0)
557
0
#define PREFETCH_L1(ptr) \
558
0
  __builtin_prefetch((ptr), 0 /* rw==read */, 3 /* locality */)
559
0
#define PREFETCH_L2(ptr) \
560
0
  __builtin_prefetch((ptr), 0 /* rw==read */, 2 /* locality */)
561
0
#elif defined(__aarch64__)
562
0
#define PREFETCH_L1(ptr)                                      \
563
0
  do {                                                        \
564
0
    __asm__ __volatile__("prfm pldl1keep, %0" ::"Q"(*(ptr))); \
565
0
  } while (0)
566
0
#define PREFETCH_L2(ptr)                                      \
567
0
  do {                                                        \
568
0
    __asm__ __volatile__("prfm pldl2keep, %0" ::"Q"(*(ptr))); \
569
0
  } while (0)
570
0
#else
571
0
#define PREFETCH_L1(ptr) \
572
0
  do {                   \
573
0
    (void)(ptr);         \
574
0
  } while (0) /* disabled */
575
0
#define PREFETCH_L2(ptr) \
576
0
  do {                   \
577
0
    (void)(ptr);         \
578
0
  } while (0) /* disabled */
579
0
#endif
580
0
581
0
/* The SIMD matchers are only faster at certain quality levels. */
582
0
#if defined(_M_X64) && defined(BROTLI_TZCNT64)
583
0
#define BROTLI_MAX_SIMD_QUALITY 7
584
0
#elif defined(BROTLI_TZCNT64)
585
0
#define BROTLI_MAX_SIMD_QUALITY 6
586
0
#endif
587
0
}
Unexecuted instantiation: decode.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: huffman.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: state.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: bit_reader.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: constants.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: context.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: platform.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: shared_dictionary.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: transform.c:BrotliSuppressUnusedFunctions
Unexecuted instantiation: dictionary.c:BrotliSuppressUnusedFunctions
588
589
#if defined(_MSC_VER)
590
#define BROTLI_CRASH() __debugbreak(), (void)abort()
591
#elif BROTLI_GNUC_HAS_BUILTIN(__builtin_trap, 3, 0, 0)
592
#define BROTLI_CRASH() (void)__builtin_trap()
593
#else
594
#define BROTLI_CRASH() (void)abort()
595
#endif
596
597
/* Make BROTLI_TEST=0 act same as undefined. */
598
#if defined(BROTLI_TEST) && ((1-BROTLI_TEST-1) == 0)
599
#undef BROTLI_TEST
600
#endif
601
602
#if BROTLI_GNUC_HAS_ATTRIBUTE(model, 3, 0, 3)
603
#define BROTLI_MODEL(M) __attribute__((model(M)))
604
#else
605
#define BROTLI_MODEL(M) /* M */
606
#endif
607
608
#endif  /* BROTLI_COMMON_PLATFORM_H_ */