Path: blob/master/thirdparty/brotli/common/platform.h
9906 views
/* Copyright 2016 Google Inc. All Rights Reserved.12Distributed under MIT license.3See file LICENSE for detail or copy at https://opensource.org/licenses/MIT4*/56/* Macros for compiler / platform specific features and build options.78Build options are:9* BROTLI_BUILD_32_BIT disables 64-bit optimizations10* BROTLI_BUILD_64_BIT forces to use 64-bit optimizations11* BROTLI_BUILD_BIG_ENDIAN forces to use big-endian optimizations12* BROTLI_BUILD_ENDIAN_NEUTRAL disables endian-aware optimizations13* BROTLI_BUILD_LITTLE_ENDIAN forces to use little-endian optimizations14* BROTLI_BUILD_NO_RBIT disables "rbit" optimization for ARM CPUs15* BROTLI_BUILD_NO_UNALIGNED_READ_FAST forces off the fast-unaligned-read16optimizations (mainly for testing purposes)17* BROTLI_DEBUG dumps file name and line number when decoder detects stream18or memory error19* BROTLI_ENABLE_LOG enables asserts and dumps various state information20* BROTLI_ENABLE_DUMP overrides default "dump" behaviour21*/2223#ifndef BROTLI_COMMON_PLATFORM_H_24#define BROTLI_COMMON_PLATFORM_H_2526#include <string.h> /* memcpy */2728#include <brotli/port.h>29#include <brotli/types.h>3031#if defined(OS_LINUX) || defined(OS_CYGWIN) || defined(__EMSCRIPTEN__)32#include <endian.h>33#elif defined(OS_FREEBSD)34#include <machine/endian.h>35#elif defined(OS_MACOSX)36#include <machine/endian.h>37/* Let's try and follow the Linux convention */38#define BROTLI_X_BYTE_ORDER BYTE_ORDER39#define BROTLI_X_LITTLE_ENDIAN LITTLE_ENDIAN40#define BROTLI_X_BIG_ENDIAN BIG_ENDIAN41#endif4243#if BROTLI_MSVC_VERSION_CHECK(18, 0, 0)44#include <intrin.h>45#endif4647#if defined(BROTLI_ENABLE_LOG) || defined(BROTLI_DEBUG)48#include <assert.h>49#include <stdio.h>50#endif5152/* The following macros were borrowed from https://github.com/nemequ/hedley53* with permission of original author - Evan Nemerson <[email protected]> */5455/* >>> >>> >>> hedley macros */5657/* Define "BROTLI_PREDICT_TRUE" and "BROTLI_PREDICT_FALSE" macros for capable58compilers.5960To apply compiler hint, enclose the branching condition into macros, like this:6162if (BROTLI_PREDICT_TRUE(zero == 0)) {63// main execution path64} else {65// compiler should place this code outside of main execution path66}6768OR:6970if (BROTLI_PREDICT_FALSE(something_rare_or_unexpected_happens)) {71// compiler should place this code outside of main execution path72}7374*/75#if BROTLI_GNUC_HAS_BUILTIN(__builtin_expect, 3, 0, 0) || \76BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \77BROTLI_SUNPRO_VERSION_CHECK(5, 15, 0) || \78BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \79BROTLI_IBM_VERSION_CHECK(10, 1, 0) || \80BROTLI_TI_VERSION_CHECK(7, 3, 0) || \81BROTLI_TINYC_VERSION_CHECK(0, 9, 27)82#define BROTLI_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))83#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))84#else85#define BROTLI_PREDICT_FALSE(x) (x)86#define BROTLI_PREDICT_TRUE(x) (x)87#endif8889#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \90!defined(__cplusplus)91#define BROTLI_RESTRICT restrict92#elif BROTLI_GNUC_VERSION_CHECK(3, 1, 0) || \93BROTLI_MSVC_VERSION_CHECK(14, 0, 0) || \94BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \95BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \96BROTLI_IBM_VERSION_CHECK(10, 1, 0) || \97BROTLI_PGI_VERSION_CHECK(17, 10, 0) || \98BROTLI_TI_VERSION_CHECK(8, 0, 0) || \99BROTLI_IAR_VERSION_CHECK(8, 0, 0) || \100(BROTLI_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus))101#define BROTLI_RESTRICT __restrict102#elif BROTLI_SUNPRO_VERSION_CHECK(5, 3, 0) && !defined(__cplusplus)103#define BROTLI_RESTRICT _Restrict104#else105#define BROTLI_RESTRICT106#endif107108#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \109(defined(__cplusplus) && (__cplusplus >= 199711L))110#define BROTLI_MAYBE_INLINE inline111#elif defined(__GNUC_STDC_INLINE__) || defined(__GNUC_GNU_INLINE__) || \112BROTLI_ARM_VERSION_CHECK(6, 2, 0)113#define BROTLI_MAYBE_INLINE __inline__114#elif BROTLI_MSVC_VERSION_CHECK(12, 0, 0) || \115BROTLI_ARM_VERSION_CHECK(4, 1, 0) || BROTLI_TI_VERSION_CHECK(8, 0, 0)116#define BROTLI_MAYBE_INLINE __inline117#else118#define BROTLI_MAYBE_INLINE119#endif120121#if BROTLI_GNUC_HAS_ATTRIBUTE(always_inline, 4, 0, 0) || \122BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \123BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \124BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \125BROTLI_IBM_VERSION_CHECK(10, 1, 0) || \126BROTLI_TI_VERSION_CHECK(8, 0, 0) || \127(BROTLI_TI_VERSION_CHECK(7, 3, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__))128#define BROTLI_INLINE BROTLI_MAYBE_INLINE __attribute__((__always_inline__))129#elif BROTLI_MSVC_VERSION_CHECK(12, 0, 0)130#define BROTLI_INLINE BROTLI_MAYBE_INLINE __forceinline131#elif BROTLI_TI_VERSION_CHECK(7, 0, 0) && defined(__cplusplus)132#define BROTLI_INLINE BROTLI_MAYBE_INLINE _Pragma("FUNC_ALWAYS_INLINE;")133#elif BROTLI_IAR_VERSION_CHECK(8, 0, 0)134#define BROTLI_INLINE BROTLI_MAYBE_INLINE _Pragma("inline=forced")135#else136#define BROTLI_INLINE BROTLI_MAYBE_INLINE137#endif138139#if BROTLI_GNUC_HAS_ATTRIBUTE(noinline, 4, 0, 0) || \140BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \141BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \142BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \143BROTLI_IBM_VERSION_CHECK(10, 1, 0) || \144BROTLI_TI_VERSION_CHECK(8, 0, 0) || \145(BROTLI_TI_VERSION_CHECK(7, 3, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__))146#define BROTLI_NOINLINE __attribute__((__noinline__))147#elif BROTLI_MSVC_VERSION_CHECK(13, 10, 0)148#define BROTLI_NOINLINE __declspec(noinline)149#elif BROTLI_PGI_VERSION_CHECK(10, 2, 0)150#define BROTLI_NOINLINE _Pragma("noinline")151#elif BROTLI_TI_VERSION_CHECK(6, 0, 0) && defined(__cplusplus)152#define BROTLI_NOINLINE _Pragma("FUNC_CANNOT_INLINE;")153#elif BROTLI_IAR_VERSION_CHECK(8, 0, 0)154#define BROTLI_NOINLINE _Pragma("inline=never")155#else156#define BROTLI_NOINLINE157#endif158159/* <<< <<< <<< end of hedley macros. */160161#if BROTLI_GNUC_HAS_ATTRIBUTE(unused, 2, 7, 0) || \162BROTLI_INTEL_VERSION_CHECK(16, 0, 0)163#define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE __attribute__ ((unused))164#else165#define BROTLI_UNUSED_FUNCTION static BROTLI_INLINE166#endif167168#if BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0)169#define BROTLI_ALIGNED(N) __attribute__((aligned(N)))170#else171#define BROTLI_ALIGNED(N)172#endif173174#if (defined(__ARM_ARCH) && (__ARM_ARCH == 7)) || \175(defined(M_ARM) && (M_ARM == 7))176#define BROTLI_TARGET_ARMV7177#endif /* ARMv7 */178179#if (defined(__ARM_ARCH) && (__ARM_ARCH == 8)) || \180defined(__aarch64__) || defined(__ARM64_ARCH_8__)181#define BROTLI_TARGET_ARMV8_ANY182183#if defined(__ARM_32BIT_STATE)184#define BROTLI_TARGET_ARMV8_32185#elif defined(__ARM_64BIT_STATE)186#define BROTLI_TARGET_ARMV8_64187#endif188189#endif /* ARMv8 */190191#if defined(__ARM_NEON__) || defined(__ARM_NEON)192#define BROTLI_TARGET_NEON193#endif194195#if defined(__i386) || defined(_M_IX86)196#define BROTLI_TARGET_X86197#endif198199#if defined(__x86_64__) || defined(_M_X64)200#define BROTLI_TARGET_X64201#endif202203#if defined(__PPC64__)204#define BROTLI_TARGET_POWERPC64205#endif206207#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64208#define BROTLI_TARGET_RISCV64209#endif210211#if defined(__loongarch_lp64)212#define BROTLI_TARGET_LOONGARCH64213#endif214215#if defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8_64) || \216defined(BROTLI_TARGET_POWERPC64) || defined(BROTLI_TARGET_RISCV64) || \217defined(BROTLI_TARGET_LOONGARCH64)218#define BROTLI_TARGET_64_BITS 1219#else220#define BROTLI_TARGET_64_BITS 0221#endif222223#if defined(BROTLI_BUILD_64_BIT)224#define BROTLI_64_BITS 1225#elif defined(BROTLI_BUILD_32_BIT)226#define BROTLI_64_BITS 0227#else228#define BROTLI_64_BITS BROTLI_TARGET_64_BITS229#endif230231#if (BROTLI_64_BITS)232#define brotli_reg_t uint64_t233#else234#define brotli_reg_t uint32_t235#endif236237#if defined(BROTLI_BUILD_BIG_ENDIAN)238#define BROTLI_BIG_ENDIAN 1239#elif defined(BROTLI_BUILD_LITTLE_ENDIAN)240#define BROTLI_LITTLE_ENDIAN 1241#elif defined(BROTLI_BUILD_ENDIAN_NEUTRAL)242/* Just break elif chain. */243#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)244#define BROTLI_LITTLE_ENDIAN 1245#elif defined(_WIN32) || defined(BROTLI_TARGET_X64)246/* Win32 & x64 can currently always be assumed to be little endian */247#define BROTLI_LITTLE_ENDIAN 1248#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)249#define BROTLI_BIG_ENDIAN 1250#elif defined(BROTLI_X_BYTE_ORDER)251#if BROTLI_X_BYTE_ORDER == BROTLI_X_LITTLE_ENDIAN252#define BROTLI_LITTLE_ENDIAN 1253#elif BROTLI_X_BYTE_ORDER == BROTLI_X_BIG_ENDIAN254#define BROTLI_BIG_ENDIAN 1255#endif256#endif /* BROTLI_X_BYTE_ORDER */257258#if !defined(BROTLI_LITTLE_ENDIAN)259#define BROTLI_LITTLE_ENDIAN 0260#endif261262#if !defined(BROTLI_BIG_ENDIAN)263#define BROTLI_BIG_ENDIAN 0264#endif265266#if defined(BROTLI_X_BYTE_ORDER)267#undef BROTLI_X_BYTE_ORDER268#undef BROTLI_X_LITTLE_ENDIAN269#undef BROTLI_X_BIG_ENDIAN270#endif271272#if defined(BROTLI_BUILD_NO_UNALIGNED_READ_FAST)273#define BROTLI_UNALIGNED_READ_FAST (!!0)274#elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) || \275defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY) || \276defined(BROTLI_TARGET_RISCV64) || defined(BROTLI_TARGET_LOONGARCH64)277/* These targets are known to generate efficient code for unaligned reads278* (e.g. a single instruction, not multiple 1-byte loads, shifted and or'd279* together). */280#define BROTLI_UNALIGNED_READ_FAST (!!1)281#else282#define BROTLI_UNALIGNED_READ_FAST (!!0)283#endif284285/* Portable unaligned memory access: read / write values via memcpy. */286static BROTLI_INLINE uint16_t BrotliUnalignedRead16(const void* p) {287uint16_t t;288memcpy(&t, p, sizeof t);289return t;290}291static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) {292uint32_t t;293memcpy(&t, p, sizeof t);294return t;295}296static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {297uint64_t t;298memcpy(&t, p, sizeof t);299return t;300}301static BROTLI_INLINE void BrotliUnalignedWrite64(void* p, uint64_t v) {302memcpy(p, &v, sizeof v);303}304305#if BROTLI_LITTLE_ENDIAN306/* Straight endianness. Just read / write values. */307#define BROTLI_UNALIGNED_LOAD16LE BrotliUnalignedRead16308#define BROTLI_UNALIGNED_LOAD32LE BrotliUnalignedRead32309#define BROTLI_UNALIGNED_LOAD64LE BrotliUnalignedRead64310#define BROTLI_UNALIGNED_STORE64LE BrotliUnalignedWrite64311#elif BROTLI_BIG_ENDIAN /* BROTLI_LITTLE_ENDIAN */312/* Explain compiler to byte-swap values. */313#define BROTLI_BSWAP16_(V) ((uint16_t)( \314(((V) & 0xFFU) << 8) | \315(((V) >> 8) & 0xFFU)))316static BROTLI_INLINE uint16_t BROTLI_UNALIGNED_LOAD16LE(const void* p) {317uint16_t value = BrotliUnalignedRead16(p);318return BROTLI_BSWAP16_(value);319}320#define BROTLI_BSWAP32_(V) ( \321(((V) & 0xFFU) << 24) | (((V) & 0xFF00U) << 8) | \322(((V) >> 8) & 0xFF00U) | (((V) >> 24) & 0xFFU))323static BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32LE(const void* p) {324uint32_t value = BrotliUnalignedRead32(p);325return BROTLI_BSWAP32_(value);326}327#define BROTLI_BSWAP64_(V) ( \328(((V) & 0xFFU) << 56) | (((V) & 0xFF00U) << 40) | \329(((V) & 0xFF0000U) << 24) | (((V) & 0xFF000000U) << 8) | \330(((V) >> 8) & 0xFF000000U) | (((V) >> 24) & 0xFF0000U) | \331(((V) >> 40) & 0xFF00U) | (((V) >> 56) & 0xFFU))332static BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void* p) {333uint64_t value = BrotliUnalignedRead64(p);334return BROTLI_BSWAP64_(value);335}336static BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void* p, uint64_t v) {337uint64_t value = BROTLI_BSWAP64_(v);338BrotliUnalignedWrite64(p, value);339}340#else /* BROTLI_LITTLE_ENDIAN */341/* Read / store values byte-wise; hopefully compiler will understand. */342static BROTLI_INLINE uint16_t BROTLI_UNALIGNED_LOAD16LE(const void* p) {343const uint8_t* in = (const uint8_t*)p;344return (uint16_t)(in[0] | (in[1] << 8));345}346static BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32LE(const void* p) {347const uint8_t* in = (const uint8_t*)p;348uint32_t value = (uint32_t)(in[0]);349value |= (uint32_t)(in[1]) << 8;350value |= (uint32_t)(in[2]) << 16;351value |= (uint32_t)(in[3]) << 24;352return value;353}354static BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void* p) {355const uint8_t* in = (const uint8_t*)p;356uint64_t value = (uint64_t)(in[0]);357value |= (uint64_t)(in[1]) << 8;358value |= (uint64_t)(in[2]) << 16;359value |= (uint64_t)(in[3]) << 24;360value |= (uint64_t)(in[4]) << 32;361value |= (uint64_t)(in[5]) << 40;362value |= (uint64_t)(in[6]) << 48;363value |= (uint64_t)(in[7]) << 56;364return value;365}366static BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void* p, uint64_t v) {367uint8_t* out = (uint8_t*)p;368out[0] = (uint8_t)v;369out[1] = (uint8_t)(v >> 8);370out[2] = (uint8_t)(v >> 16);371out[3] = (uint8_t)(v >> 24);372out[4] = (uint8_t)(v >> 32);373out[5] = (uint8_t)(v >> 40);374out[6] = (uint8_t)(v >> 48);375out[7] = (uint8_t)(v >> 56);376}377#endif /* BROTLI_LITTLE_ENDIAN */378379static BROTLI_INLINE void* BROTLI_UNALIGNED_LOAD_PTR(const void* p) {380void* v;381memcpy(&v, p, sizeof(void*));382return v;383}384385static BROTLI_INLINE void BROTLI_UNALIGNED_STORE_PTR(void* p, const void* v) {386memcpy(p, &v, sizeof(void*));387}388389/* BROTLI_IS_CONSTANT macros returns true for compile-time constants. */390#if BROTLI_GNUC_HAS_BUILTIN(__builtin_constant_p, 3, 0, 1) || \391BROTLI_INTEL_VERSION_CHECK(16, 0, 0)392#define BROTLI_IS_CONSTANT(x) (!!__builtin_constant_p(x))393#else394#define BROTLI_IS_CONSTANT(x) (!!0)395#endif396397#if defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY)398#define BROTLI_HAS_UBFX (!!1)399#else400#define BROTLI_HAS_UBFX (!!0)401#endif402403#if defined(BROTLI_ENABLE_LOG)404#define BROTLI_LOG(x) printf x405#else406#define BROTLI_LOG(x)407#endif408409#if defined(BROTLI_DEBUG) || defined(BROTLI_ENABLE_LOG)410#define BROTLI_ENABLE_DUMP_DEFAULT 1411#define BROTLI_DCHECK(x) assert(x)412#else413#define BROTLI_ENABLE_DUMP_DEFAULT 0414#define BROTLI_DCHECK(x)415#endif416417#if !defined(BROTLI_ENABLE_DUMP)418#define BROTLI_ENABLE_DUMP BROTLI_ENABLE_DUMP_DEFAULT419#endif420421#if BROTLI_ENABLE_DUMP422static BROTLI_INLINE void BrotliDump(const char* f, int l, const char* fn) {423fprintf(stderr, "%s:%d (%s)\n", f, l, fn);424fflush(stderr);425}426#define BROTLI_DUMP() BrotliDump(__FILE__, __LINE__, __FUNCTION__)427#else428#define BROTLI_DUMP() (void)(0)429#endif430431/* BrotliRBit assumes brotli_reg_t fits native CPU register type. */432#if (BROTLI_64_BITS == BROTLI_TARGET_64_BITS)433/* TODO(eustas): add appropriate icc/sunpro/arm/ibm/ti checks. */434#if (BROTLI_GNUC_VERSION_CHECK(3, 0, 0) || defined(__llvm__)) && \435!defined(BROTLI_BUILD_NO_RBIT)436#if defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_ANY)437/* TODO(eustas): detect ARMv6T2 and enable this code for it. */438static BROTLI_INLINE brotli_reg_t BrotliRBit(brotli_reg_t input) {439brotli_reg_t output;440__asm__("rbit %0, %1\n" : "=r"(output) : "r"(input));441return output;442}443#define BROTLI_RBIT(x) BrotliRBit(x)444#endif /* armv7 / armv8 */445#endif /* gcc || clang */446#endif /* brotli_reg_t is native */447#if !defined(BROTLI_RBIT)448static BROTLI_INLINE void BrotliRBit(void) { /* Should break build if used. */ }449#endif /* BROTLI_RBIT */450451#define BROTLI_REPEAT_4(X) {X; X; X; X;}452#define BROTLI_REPEAT_5(X) {X; X; X; X; X;}453#define BROTLI_REPEAT_6(X) {X; X; X; X; X; X;}454455#define BROTLI_UNUSED(X) (void)(X)456457#define BROTLI_MIN_MAX(T) \458static BROTLI_INLINE T brotli_min_ ## T (T a, T b) { return a < b ? a : b; } \459static BROTLI_INLINE T brotli_max_ ## T (T a, T b) { return a > b ? a : b; }460BROTLI_MIN_MAX(double) BROTLI_MIN_MAX(float) BROTLI_MIN_MAX(int)461BROTLI_MIN_MAX(size_t) BROTLI_MIN_MAX(uint32_t) BROTLI_MIN_MAX(uint8_t)462#undef BROTLI_MIN_MAX463#define BROTLI_MIN(T, A, B) (brotli_min_ ## T((A), (B)))464#define BROTLI_MAX(T, A, B) (brotli_max_ ## T((A), (B)))465466#define BROTLI_SWAP(T, A, I, J) { \467T __brotli_swap_tmp = (A)[(I)]; \468(A)[(I)] = (A)[(J)]; \469(A)[(J)] = __brotli_swap_tmp; \470}471472#if BROTLI_64_BITS473#if BROTLI_GNUC_HAS_BUILTIN(__builtin_ctzll, 3, 4, 0) || \474BROTLI_INTEL_VERSION_CHECK(16, 0, 0)475#define BROTLI_TZCNT64 __builtin_ctzll476#elif BROTLI_MSVC_VERSION_CHECK(18, 0, 0)477#if defined(BROTLI_TARGET_X64)478#define BROTLI_TZCNT64 _tzcnt_u64479#else /* BROTLI_TARGET_X64 */480static BROTLI_INLINE uint32_t BrotliBsf64Msvc(uint64_t x) {481uint32_t lsb;482_BitScanForward64(&lsb, x);483return lsb;484}485#define BROTLI_TZCNT64 BrotliBsf64Msvc486#endif /* BROTLI_TARGET_X64 */487#endif /* __builtin_ctzll */488#endif /* BROTLI_64_BITS */489490#if BROTLI_GNUC_HAS_BUILTIN(__builtin_clz, 3, 4, 0) || \491BROTLI_INTEL_VERSION_CHECK(16, 0, 0)492#define BROTLI_BSR32(x) (31u ^ (uint32_t)__builtin_clz(x))493#elif BROTLI_MSVC_VERSION_CHECK(18, 0, 0)494static BROTLI_INLINE uint32_t BrotliBsr32Msvc(uint32_t x) {495unsigned long msb;496_BitScanReverse(&msb, x);497return (uint32_t)msb;498}499#define BROTLI_BSR32 BrotliBsr32Msvc500#endif /* __builtin_clz */501502/* Default brotli_alloc_func */503BROTLI_COMMON_API void* BrotliDefaultAllocFunc(void* opaque, size_t size);504505/* Default brotli_free_func */506BROTLI_COMMON_API void BrotliDefaultFreeFunc(void* opaque, void* address);507508BROTLI_UNUSED_FUNCTION void BrotliSuppressUnusedFunctions(void) {509BROTLI_UNUSED(&BrotliSuppressUnusedFunctions);510BROTLI_UNUSED(&BrotliUnalignedRead16);511BROTLI_UNUSED(&BrotliUnalignedRead32);512BROTLI_UNUSED(&BrotliUnalignedRead64);513BROTLI_UNUSED(&BrotliUnalignedWrite64);514BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD16LE);515BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD32LE);516BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD64LE);517BROTLI_UNUSED(&BROTLI_UNALIGNED_STORE64LE);518BROTLI_UNUSED(&BROTLI_UNALIGNED_LOAD_PTR);519BROTLI_UNUSED(&BROTLI_UNALIGNED_STORE_PTR);520BROTLI_UNUSED(&BrotliRBit);521BROTLI_UNUSED(&brotli_min_double);522BROTLI_UNUSED(&brotli_max_double);523BROTLI_UNUSED(&brotli_min_float);524BROTLI_UNUSED(&brotli_max_float);525BROTLI_UNUSED(&brotli_min_int);526BROTLI_UNUSED(&brotli_max_int);527BROTLI_UNUSED(&brotli_min_size_t);528BROTLI_UNUSED(&brotli_max_size_t);529BROTLI_UNUSED(&brotli_min_uint32_t);530BROTLI_UNUSED(&brotli_max_uint32_t);531BROTLI_UNUSED(&brotli_min_uint8_t);532BROTLI_UNUSED(&brotli_max_uint8_t);533BROTLI_UNUSED(&BrotliDefaultAllocFunc);534BROTLI_UNUSED(&BrotliDefaultFreeFunc);535#if BROTLI_ENABLE_DUMP536BROTLI_UNUSED(&BrotliDump);537#endif538}539540#endif /* BROTLI_COMMON_PLATFORM_H_ */541542543