/src/woff2/brotli/c/common/platform.h
Line | Count | Source |
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 | | #ifndef BROTLI_COMMON_PLATFORM_H_ |
10 | | #define BROTLI_COMMON_PLATFORM_H_ |
11 | | |
12 | | #include <string.h> /* memcpy */ |
13 | | #include <stdlib.h> /* malloc, free */ |
14 | | |
15 | | #include <brotli/port.h> |
16 | | #include <brotli/types.h> |
17 | | |
18 | | #if defined OS_LINUX || defined OS_CYGWIN |
19 | | #include <endian.h> |
20 | | #elif defined OS_FREEBSD |
21 | | #include <machine/endian.h> |
22 | | #elif defined OS_MACOSX |
23 | | #include <machine/endian.h> |
24 | | /* Let's try and follow the Linux convention */ |
25 | | #define BROTLI_X_BYTE_ORDER BYTE_ORDER |
26 | | #define BROTLI_X_LITTLE_ENDIAN LITTLE_ENDIAN |
27 | | #define BROTLI_X_BIG_ENDIAN BIG_ENDIAN |
28 | | #endif |
29 | | |
30 | | #if defined(BROTLI_ENABLE_LOG) || defined(BROTLI_DEBUG) |
31 | | #include <assert.h> |
32 | | #include <stdio.h> |
33 | | #endif |
34 | | |
35 | | /* Macros for compiler / platform specific features and build options. |
36 | | |
37 | | Build options are: |
38 | | * BROTLI_BUILD_32_BIT disables 64-bit optimizations |
39 | | * BROTLI_BUILD_64_BIT forces to use 64-bit optimizations |
40 | | * BROTLI_BUILD_BIG_ENDIAN forces to use big-endian optimizations |
41 | | * BROTLI_BUILD_ENDIAN_NEUTRAL disables endian-aware optimizations |
42 | | * BROTLI_BUILD_LITTLE_ENDIAN forces to use little-endian optimizations |
43 | | * BROTLI_BUILD_PORTABLE disables dangerous optimizations, like unaligned |
44 | | read and overlapping memcpy; this reduces decompression speed by 5% |
45 | | * BROTLI_BUILD_NO_RBIT disables "rbit" optimization for ARM CPUs |
46 | | * BROTLI_DEBUG dumps file name and line number when decoder detects stream |
47 | | or memory error |
48 | | * BROTLI_ENABLE_LOG enables asserts and dumps various state information |
49 | | */ |
50 | | |
51 | | #if BROTLI_MODERN_COMPILER || __has_attribute(always_inline) |
52 | | #define BROTLI_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) |
53 | | #else |
54 | | #define BROTLI_ATTRIBUTE_ALWAYS_INLINE |
55 | | #endif |
56 | | |
57 | | #if defined(_WIN32) || defined(__CYGWIN__) |
58 | | #define BROTLI_ATTRIBUTE_VISIBILITY_HIDDEN |
59 | | #elif BROTLI_MODERN_COMPILER || __has_attribute(visibility) |
60 | | #define BROTLI_ATTRIBUTE_VISIBILITY_HIDDEN \ |
61 | | __attribute__ ((visibility ("hidden"))) |
62 | | #else |
63 | | #define BROTLI_ATTRIBUTE_VISIBILITY_HIDDEN |
64 | | #endif |
65 | | |
66 | | #ifndef BROTLI_INTERNAL |
67 | | #define BROTLI_INTERNAL BROTLI_ATTRIBUTE_VISIBILITY_HIDDEN |
68 | | #endif |
69 | | |
70 | | #ifndef _MSC_VER |
71 | | #if defined(__cplusplus) || !defined(__STRICT_ANSI__) || \ |
72 | | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) |
73 | | #define BROTLI_INLINE inline BROTLI_ATTRIBUTE_ALWAYS_INLINE |
74 | | #else |
75 | | #define BROTLI_INLINE |
76 | | #endif |
77 | | #else /* _MSC_VER */ |
78 | | #define BROTLI_INLINE __forceinline |
79 | | #endif /* _MSC_VER */ |
80 | | |
81 | | #if BROTLI_MODERN_COMPILER || __has_attribute(unused) |
82 | | #define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE __attribute__ ((unused)) |
83 | | #else |
84 | | #define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE |
85 | | #endif |
86 | | |
87 | | #if !defined(__cplusplus) && !defined(c_plusplus) && \ |
88 | | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) |
89 | | #define BROTLI_RESTRICT restrict |
90 | | #elif BROTLI_GCC_VERSION > 295 || defined(__llvm__) |
91 | | #define BROTLI_RESTRICT __restrict |
92 | | #else |
93 | | #define BROTLI_RESTRICT |
94 | | #endif |
95 | | |
96 | | #if BROTLI_MODERN_COMPILER || __has_attribute(noinline) |
97 | | #define BROTLI_NOINLINE __attribute__((noinline)) |
98 | | #else |
99 | | #define BROTLI_NOINLINE |
100 | | #endif |
101 | | |
102 | | #if defined(__arm__) || defined(__thumb__) || \ |
103 | | defined(_M_ARM) || defined(_M_ARMT) || defined(__ARM64_ARCH_8__) |
104 | | #define BROTLI_TARGET_ARM |
105 | | #if (defined(__ARM_ARCH) && (__ARM_ARCH == 7)) || \ |
106 | | (defined(M_ARM) && (M_ARM == 7)) |
107 | | #define BROTLI_TARGET_ARMV7 |
108 | | #endif /* ARMv7 */ |
109 | | #if defined(__aarch64__) || defined(__ARM64_ARCH_8__) |
110 | | #define BROTLI_TARGET_ARMV8 |
111 | | #endif /* ARMv8 */ |
112 | | #endif /* ARM */ |
113 | | |
114 | | #if defined(__i386) || defined(_M_IX86) |
115 | | #define BROTLI_TARGET_X86 |
116 | | #endif |
117 | | |
118 | | #if defined(__x86_64__) || defined(_M_X64) |
119 | | #define BROTLI_TARGET_X64 |
120 | | #endif |
121 | | |
122 | | #if defined(__PPC64__) |
123 | | #define BROTLI_TARGET_POWERPC64 |
124 | | #endif |
125 | | |
126 | | #if defined(BROTLI_BUILD_64_BIT) |
127 | | #define BROTLI_64_BITS 1 |
128 | | #elif defined(BROTLI_BUILD_32_BIT) |
129 | | #define BROTLI_64_BITS 0 |
130 | | #elif defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8) || \ |
131 | | defined(BROTLI_TARGET_POWERPC64) |
132 | 1.79G | #define BROTLI_64_BITS 1 |
133 | | #else |
134 | | #define BROTLI_64_BITS 0 |
135 | | #endif |
136 | | |
137 | | #if (BROTLI_64_BITS) |
138 | 279k | #define brotli_reg_t uint64_t |
139 | | #else |
140 | | #define brotli_reg_t uint32_t |
141 | | #endif |
142 | | |
143 | | #if defined(BROTLI_BUILD_BIG_ENDIAN) |
144 | | #define BROTLI_BIG_ENDIAN 1 |
145 | | #elif defined(BROTLI_BUILD_LITTLE_ENDIAN) |
146 | | #define BROTLI_LITTLE_ENDIAN 1 |
147 | | #elif defined(BROTLI_BUILD_ENDIAN_NEUTRAL) |
148 | | /* Just break elif chain. */ |
149 | | #elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) |
150 | | #define BROTLI_LITTLE_ENDIAN 1 |
151 | | #elif defined(_WIN32) || defined(BROTLI_TARGET_X64) |
152 | | /* Win32 & x64 can currently always be assumed to be little endian */ |
153 | | #define BROTLI_LITTLE_ENDIAN 1 |
154 | | #elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) |
155 | | #define BROTLI_BIG_ENDIAN 1 |
156 | | #elif defined(BROTLI_X_BYTE_ORDER) |
157 | | #if BROTLI_X_BYTE_ORDER == BROTLI_X_LITTLE_ENDIAN |
158 | | #define BROTLI_LITTLE_ENDIAN 1 |
159 | | #elif BROTLI_X_BYTE_ORDER == BROTLI_X_BIG_ENDIAN |
160 | | #define BROTLI_BIG_ENDIAN 1 |
161 | | #endif |
162 | | #endif /* BROTLI_X_BYTE_ORDER */ |
163 | | |
164 | | #if !defined(BROTLI_LITTLE_ENDIAN) |
165 | | #define BROTLI_LITTLE_ENDIAN 0 |
166 | | #endif |
167 | | |
168 | | #if !defined(BROTLI_BIG_ENDIAN) |
169 | | #define BROTLI_BIG_ENDIAN 0 |
170 | | #endif |
171 | | |
172 | | #ifdef BROTLI_X_BYTE_ORDER |
173 | | #undef BROTLI_X_BYTE_ORDER |
174 | | #undef BROTLI_X_LITTLE_ENDIAN |
175 | | #undef BROTLI_X_BIG_ENDIAN |
176 | | #endif |
177 | | |
178 | | #ifdef BROTLI_BUILD_PORTABLE |
179 | | #define BROTLI_ALIGNED_READ (!!1) |
180 | | #elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) || \ |
181 | | defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8) |
182 | | /* Allow unaligned read only for white-listed CPUs. */ |
183 | 2.16G | #define BROTLI_ALIGNED_READ (!!0) |
184 | | #else |
185 | | #define BROTLI_ALIGNED_READ (!!1) |
186 | | #endif |
187 | | |
188 | | #if BROTLI_ALIGNED_READ |
189 | | /* Portable unaligned memory access: read / write values via memcpy. */ |
190 | | static BROTLI_INLINE uint16_t BrotliUnalignedRead16(const void* p) { |
191 | | uint16_t t; |
192 | | memcpy(&t, p, sizeof t); |
193 | | return t; |
194 | | } |
195 | | static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) { |
196 | | uint32_t t; |
197 | | memcpy(&t, p, sizeof t); |
198 | | return t; |
199 | | } |
200 | | static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) { |
201 | | uint64_t t; |
202 | | memcpy(&t, p, sizeof t); |
203 | | return t; |
204 | | } |
205 | | static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) { |
206 | | memcpy(p, &v, sizeof v); |
207 | | } |
208 | | #else /* BROTLI_ALIGNED_READ */ |
209 | | /* Unaligned memory access is allowed: just cast pointer to requested type. */ |
210 | 0 | static BROTLI_INLINE uint16_t BrotliUnalignedRead16(const void* p) { |
211 | 0 | return *(const uint16_t*)p; |
212 | 0 | } Unexecuted instantiation: decode.c:BrotliUnalignedRead16 Unexecuted instantiation: huffman.c:BrotliUnalignedRead16 Unexecuted instantiation: state.c:BrotliUnalignedRead16 Unexecuted instantiation: transform.c:BrotliUnalignedRead16 Unexecuted instantiation: bit_reader.c:BrotliUnalignedRead16 |
213 | 8.42M | static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) { |
214 | 8.42M | return *(const uint32_t*)p; |
215 | 8.42M | } decode.c:BrotliUnalignedRead32 Line | Count | Source | 213 | 8.42M | static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) { | 214 | 8.42M | return *(const uint32_t*)p; | 215 | 8.42M | } |
Unexecuted instantiation: huffman.c:BrotliUnalignedRead32 Unexecuted instantiation: state.c:BrotliUnalignedRead32 Unexecuted instantiation: transform.c:BrotliUnalignedRead32 Unexecuted instantiation: bit_reader.c:BrotliUnalignedRead32 |
216 | 1.29M | static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) { |
217 | 1.29M | return *(const uint64_t*)p; |
218 | 1.29M | } decode.c:BrotliUnalignedRead64 Line | Count | Source | 216 | 1.29M | static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) { | 217 | 1.29M | return *(const uint64_t*)p; | 218 | 1.29M | } |
Unexecuted instantiation: huffman.c:BrotliUnalignedRead64 Unexecuted instantiation: state.c:BrotliUnalignedRead64 Unexecuted instantiation: transform.c:BrotliUnalignedRead64 Unexecuted instantiation: bit_reader.c:BrotliUnalignedRead64 |
219 | 0 | static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) { |
220 | 0 | *(uint64_t*)p = v; |
221 | 0 | } Unexecuted instantiation: decode.c:BrotliUnalignedWrite64 Unexecuted instantiation: huffman.c:BrotliUnalignedWrite64 Unexecuted instantiation: state.c:BrotliUnalignedWrite64 Unexecuted instantiation: transform.c:BrotliUnalignedWrite64 Unexecuted instantiation: bit_reader.c:BrotliUnalignedWrite64 |
222 | | #endif /* BROTLI_ALIGNED_READ */ |
223 | | |
224 | | #if BROTLI_LITTLE_ENDIAN |
225 | | /* Straight endianness. Just read / write values. */ |
226 | | #define BROTLI_UNALIGNED_LOAD16LE BrotliUnalignedRead16 |
227 | 8.42M | #define BROTLI_UNALIGNED_LOAD32LE BrotliUnalignedRead32 |
228 | 1.29M | #define BROTLI_UNALIGNED_LOAD64LE BrotliUnalignedRead64 |
229 | | #define BROTLI_UNALIGNED_STORE64LE BrotliUnalignedWrite64 |
230 | | #elif BROTLI_BIG_ENDIAN /* BROTLI_LITTLE_ENDIAN */ |
231 | | /* Explain compiler to byte-swap values. */ |
232 | | #define BROTLI_BSWAP16_(V) ((uint16_t)( \ |
233 | | (((V) & 0xFFU) << 8) | \ |
234 | | (((V) >> 8) & 0xFFU))) |
235 | | static BROTLI_INLINE uint16_t BROTLI_UNALIGNED_LOAD16LE(const void* p) { |
236 | | uint16_t value = BrotliUnalignedRead16(p); |
237 | | return BROTLI_BSWAP16_(value); |
238 | | } |
239 | | #define BROTLI_BSWAP32_(V) ( \ |
240 | | (((V) & 0xFFU) << 24) | (((V) & 0xFF00U) << 8) | \ |
241 | | (((V) >> 8) & 0xFF00U) | (((V) >> 24) & 0xFFU)) |
242 | | static BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32LE(const void* p) { |
243 | | uint32_t value = BrotliUnalignedRead32(p); |
244 | | return BROTLI_BSWAP32_(value); |
245 | | } |
246 | | #define BROTLI_BSWAP64_(V) ( \ |
247 | | (((V) & 0xFFU) << 56) | (((V) & 0xFF00U) << 40) | \ |
248 | | (((V) & 0xFF0000U) << 24) | (((V) & 0xFF000000U) << 8) | \ |
249 | | (((V) >> 8) & 0xFF000000U) | (((V) >> 24) & 0xFF0000U) | \ |
250 | | (((V) >> 40) & 0xFF00U) | (((V) >> 56) & 0xFFU)) |
251 | | static BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void* p) { |
252 | | uint64_t value = BrotliUnalignedRead64(p); |
253 | | return BROTLI_BSWAP64_(value); |
254 | | } |
255 | | static BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void* p, uint64_t v) { |
256 | | uint64_t value = BROTLI_BSWAP64_(v); |
257 | | BrotliUnalignedWrite64(p, value); |
258 | | } |
259 | | #else /* BROTLI_LITTLE_ENDIAN */ |
260 | | /* Read / store values byte-wise; hopefully compiler will understand. */ |
261 | | static BROTLI_INLINE uint16_t BROTLI_UNALIGNED_LOAD16LE(const void* p) { |
262 | | const uint8_t* in = (const uint8_t*)p; |
263 | | return (uint16_t)(in[0] | (in[1] << 8)); |
264 | | } |
265 | | static BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32LE(const void* p) { |
266 | | const uint8_t* in = (const uint8_t*)p; |
267 | | uint32_t value = (uint32_t)(in[0]); |
268 | | value |= (uint32_t)(in[1]) << 8; |
269 | | value |= (uint32_t)(in[2]) << 16; |
270 | | value |= (uint32_t)(in[3]) << 24; |
271 | | return value; |
272 | | } |
273 | | static BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void* p) { |
274 | | const uint8_t* in = (const uint8_t*)p; |
275 | | uint64_t value = (uint64_t)(in[0]); |
276 | | value |= (uint64_t)(in[1]) << 8; |
277 | | value |= (uint64_t)(in[2]) << 16; |
278 | | value |= (uint64_t)(in[3]) << 24; |
279 | | value |= (uint64_t)(in[4]) << 32; |
280 | | value |= (uint64_t)(in[5]) << 40; |
281 | | value |= (uint64_t)(in[6]) << 48; |
282 | | value |= (uint64_t)(in[7]) << 56; |
283 | | return value; |
284 | | } |
285 | | static BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void* p, uint64_t v) { |
286 | | uint8_t* out = (uint8_t*)p; |
287 | | out[0] = (uint8_t)v; |
288 | | out[1] = (uint8_t)(v >> 8); |
289 | | out[2] = (uint8_t)(v >> 16); |
290 | | out[3] = (uint8_t)(v >> 24); |
291 | | out[4] = (uint8_t)(v >> 32); |
292 | | out[5] = (uint8_t)(v >> 40); |
293 | | out[6] = (uint8_t)(v >> 48); |
294 | | out[7] = (uint8_t)(v >> 56); |
295 | | } |
296 | | #endif /* BROTLI_LITTLE_ENDIAN */ |
297 | | |
298 | | /* Define "BROTLI_PREDICT_TRUE" and "BROTLI_PREDICT_FALSE" macros for capable |
299 | | compilers. |
300 | | |
301 | | To apply compiler hint, enclose the branching condition into macros, like this: |
302 | | |
303 | | if (BROTLI_PREDICT_TRUE(zero == 0)) { |
304 | | // main execution path |
305 | | } else { |
306 | | // compiler should place this code outside of main execution path |
307 | | } |
308 | | |
309 | | OR: |
310 | | |
311 | | if (BROTLI_PREDICT_FALSE(something_rare_or_unexpected_happens)) { |
312 | | // compiler should place this code outside of main execution path |
313 | | } |
314 | | |
315 | | */ |
316 | | #if BROTLI_MODERN_COMPILER || __has_builtin(__builtin_expect) |
317 | 1.39G | #define BROTLI_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1)) |
318 | 6.08G | #define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0)) |
319 | | #else |
320 | | #define BROTLI_PREDICT_FALSE(x) (x) |
321 | | #define BROTLI_PREDICT_TRUE(x) (x) |
322 | | #endif |
323 | | |
324 | | /* BROTLI_IS_CONSTANT macros returns true for compile-time constants. */ |
325 | | #if BROTLI_MODERN_COMPILER || __has_builtin(__builtin_constant_p) |
326 | 5.83G | #define BROTLI_IS_CONSTANT(x) (!!__builtin_constant_p(x)) |
327 | | #else |
328 | | #define BROTLI_IS_CONSTANT(x) (!!0) |
329 | | #endif |
330 | | |
331 | | #if defined(BROTLI_TARGET_ARM) |
332 | | #define BROTLI_HAS_UBFX (!!1) |
333 | | #else |
334 | 71.4M | #define BROTLI_HAS_UBFX (!!0) |
335 | | #endif |
336 | | |
337 | | #ifdef BROTLI_ENABLE_LOG |
338 | | #define BROTLI_DCHECK(x) assert(x) |
339 | | #define BROTLI_LOG(x) printf x |
340 | | #else |
341 | | #define BROTLI_DCHECK(x) |
342 | | #define BROTLI_LOG(x) |
343 | | #endif |
344 | | |
345 | | #if defined(BROTLI_DEBUG) || defined(BROTLI_ENABLE_LOG) |
346 | | static BROTLI_INLINE void BrotliDump(const char* f, int l, const char* fn) { |
347 | | fprintf(stderr, "%s:%d (%s)\n", f, l, fn); |
348 | | fflush(stderr); |
349 | | } |
350 | | #define BROTLI_DUMP() BrotliDump(__FILE__, __LINE__, __FUNCTION__) |
351 | | #else |
352 | 2.30k | #define BROTLI_DUMP() (void)(0) |
353 | | #endif |
354 | | |
355 | | #if (BROTLI_MODERN_COMPILER || defined(__llvm__)) && \ |
356 | | !defined(BROTLI_BUILD_NO_RBIT) |
357 | | #if defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8) |
358 | | /* TODO: detect ARMv6T2 and enable this code for it. */ |
359 | | static BROTLI_INLINE brotli_reg_t BrotliRBit(brotli_reg_t input) { |
360 | | brotli_reg_t output; |
361 | | __asm__("rbit %0, %1\n" : "=r"(output) : "r"(input)); |
362 | | return output; |
363 | | } |
364 | | #define BROTLI_RBIT(x) BrotliRBit(x) |
365 | | #endif /* armv7 */ |
366 | | #endif /* gcc || clang */ |
367 | | #if !defined(BROTLI_RBIT) |
368 | 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: transform.c:BrotliRBit Unexecuted instantiation: bit_reader.c:BrotliRBit |
369 | | #endif /* BROTLI_RBIT */ |
370 | | |
371 | 1.34M | #define BROTLI_REPEAT(N, X) { \ |
372 | 1.34M | if ((N & 1) != 0) {X;} \ |
373 | 1.34M | if ((N & 2) != 0) {X; X;} \ |
374 | 1.34M | if ((N & 4) != 0) {X; X; X; X;} \ |
375 | 1.34M | } |
376 | | |
377 | 1.37M | #define BROTLI_UNUSED(X) (void)(X) |
378 | | |
379 | | #define BROTLI_MIN_MAX(T) \ |
380 | 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: 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: 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 |
381 | 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: 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: 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 |
382 | | BROTLI_MIN_MAX(double) BROTLI_MIN_MAX(float) BROTLI_MIN_MAX(int) |
383 | | BROTLI_MIN_MAX(size_t) BROTLI_MIN_MAX(uint32_t) BROTLI_MIN_MAX(uint8_t) |
384 | | #undef BROTLI_MIN_MAX |
385 | | #define BROTLI_MIN(T, A, B) (brotli_min_ ## T((A), (B))) |
386 | | #define BROTLI_MAX(T, A, B) (brotli_max_ ## T((A), (B))) |
387 | | |
388 | | #define BROTLI_SWAP(T, A, I, J) { \ |
389 | | T __brotli_swap_tmp = (A)[(I)]; \ |
390 | | (A)[(I)] = (A)[(J)]; \ |
391 | | (A)[(J)] = __brotli_swap_tmp; \ |
392 | | } |
393 | | |
394 | | /* Default brotli_alloc_func */ |
395 | 139k | static void* BrotliDefaultAllocFunc(void* opaque, size_t size) { |
396 | 139k | BROTLI_UNUSED(opaque); |
397 | 139k | return malloc(size); |
398 | 139k | } Unexecuted instantiation: decode.c:BrotliDefaultAllocFunc Unexecuted instantiation: huffman.c:BrotliDefaultAllocFunc state.c:BrotliDefaultAllocFunc Line | Count | Source | 395 | 139k | static void* BrotliDefaultAllocFunc(void* opaque, size_t size) { | 396 | 139k | BROTLI_UNUSED(opaque); | 397 | 139k | return malloc(size); | 398 | 139k | } |
Unexecuted instantiation: transform.c:BrotliDefaultAllocFunc Unexecuted instantiation: bit_reader.c:BrotliDefaultAllocFunc |
399 | | |
400 | | /* Default brotli_free_func */ |
401 | 1.20M | static void BrotliDefaultFreeFunc(void* opaque, void* address) { |
402 | 1.20M | BROTLI_UNUSED(opaque); |
403 | 1.20M | free(address); |
404 | 1.20M | } Unexecuted instantiation: decode.c:BrotliDefaultFreeFunc Unexecuted instantiation: huffman.c:BrotliDefaultFreeFunc state.c:BrotliDefaultFreeFunc Line | Count | Source | 401 | 1.20M | static void BrotliDefaultFreeFunc(void* opaque, void* address) { | 402 | 1.20M | BROTLI_UNUSED(opaque); | 403 | 1.20M | free(address); | 404 | 1.20M | } |
Unexecuted instantiation: transform.c:BrotliDefaultFreeFunc Unexecuted instantiation: bit_reader.c:BrotliDefaultFreeFunc |
405 | | |
406 | 0 | BROTLI_UNUSED_FUNCTION void BrotliSuppressUnusedFunctions(void) { |
407 | 0 | BROTLI_UNUSED(BrotliSuppressUnusedFunctions); |
408 | 0 | BROTLI_UNUSED(BrotliUnalignedRead16); |
409 | 0 | BROTLI_UNUSED(BrotliUnalignedRead32); |
410 | 0 | BROTLI_UNUSED(BrotliUnalignedRead64); |
411 | 0 | BROTLI_UNUSED(BrotliUnalignedWrite64); |
412 | 0 | BROTLI_UNUSED(BROTLI_UNALIGNED_LOAD16LE); |
413 | 0 | BROTLI_UNUSED(BROTLI_UNALIGNED_LOAD32LE); |
414 | 0 | BROTLI_UNUSED(BROTLI_UNALIGNED_LOAD64LE); |
415 | 0 | BROTLI_UNUSED(BROTLI_UNALIGNED_STORE64LE); |
416 | 0 | BROTLI_UNUSED(BrotliRBit); |
417 | 0 | BROTLI_UNUSED(brotli_min_double); |
418 | 0 | BROTLI_UNUSED(brotli_max_double); |
419 | 0 | BROTLI_UNUSED(brotli_min_float); |
420 | 0 | BROTLI_UNUSED(brotli_max_float); |
421 | 0 | BROTLI_UNUSED(brotli_min_int); |
422 | 0 | BROTLI_UNUSED(brotli_max_int); |
423 | 0 | BROTLI_UNUSED(brotli_min_size_t); |
424 | 0 | BROTLI_UNUSED(brotli_max_size_t); |
425 | 0 | BROTLI_UNUSED(brotli_min_uint32_t); |
426 | 0 | BROTLI_UNUSED(brotli_max_uint32_t); |
427 | 0 | BROTLI_UNUSED(brotli_min_uint8_t); |
428 | 0 | BROTLI_UNUSED(brotli_max_uint8_t); |
429 | 0 | BROTLI_UNUSED(BrotliDefaultAllocFunc); |
430 | 0 | BROTLI_UNUSED(BrotliDefaultFreeFunc); |
431 | 0 | #if defined(BROTLI_DEBUG) || defined(BROTLI_ENABLE_LOG) |
432 | 0 | BROTLI_UNUSED(BrotliDump); |
433 | 0 | #endif |
434 | 0 | } Unexecuted instantiation: decode.c:BrotliSuppressUnusedFunctions Unexecuted instantiation: huffman.c:BrotliSuppressUnusedFunctions Unexecuted instantiation: state.c:BrotliSuppressUnusedFunctions Unexecuted instantiation: transform.c:BrotliSuppressUnusedFunctions Unexecuted instantiation: bit_reader.c:BrotliSuppressUnusedFunctions |
435 | | |
436 | | #endif /* BROTLI_COMMON_PLATFORM_H_ */ |