1771eb107985566d2e458e3f06f2c7bd1b21c2dcaEugene Klyuchnikov/* Copyright 2013 Google Inc. All Rights Reserved. 2771eb107985566d2e458e3f06f2c7bd1b21c2dcaEugene Klyuchnikov 324ffa78414663b545b66be392caff7eb5574a62cEugene Klyuchnikov Distributed under MIT license. 4771eb107985566d2e458e3f06f2c7bd1b21c2dcaEugene Klyuchnikov See file LICENSE for detail or copy at https://opensource.org/licenses/MIT 5771eb107985566d2e458e3f06f2c7bd1b21c2dcaEugene Klyuchnikov*/ 6771eb107985566d2e458e3f06f2c7bd1b21c2dcaEugene Klyuchnikov 7352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov/* Macros for endianness, branch prediction and unaligned loads and stores. */ 8c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 9c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#ifndef BROTLI_ENC_PORT_H_ 10c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#define BROTLI_ENC_PORT_H_ 11c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 12bb26d1919ffb813fb1f36e3675949b172c2b51a4Eugene Klyuchnikov#include <assert.h> 13352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov#include <string.h> /* memcpy */ 14028291865dbc2f92bb114dd082f5ff78c907a875Eugene Kliuchnikov 150a63f99db9eeb8a15dc3941b96802141b1993912Eugene Kliuchnikov#include <brotli/port.h> 1681480011581d1bb40e2ed26566a95d060f2767b3Eugene Kliuchnikov#include <brotli/types.h> 1765f3fc55f562452e64156525d5dc0fcd9fbaf898Zoltan Szabadka 18c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#if defined OS_LINUX || defined OS_CYGWIN 19c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#include <endian.h> 20c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#elif defined OS_FREEBSD 21c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#include <machine/endian.h> 22c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#elif defined OS_MACOSX 23c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#include <machine/endian.h> 24c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka/* Let's try and follow the Linux convention */ 25c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#define __BYTE_ORDER BYTE_ORDER 26c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#define __LITTLE_ENDIAN LITTLE_ENDIAN 27c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#endif 28c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 29d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov/* define the macro BROTLI_LITTLE_ENDIAN 30352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov using the above endian definitions from endian.h if 31352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov endian.h was included */ 32c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#ifdef __BYTE_ORDER 33c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#if __BYTE_ORDER == __LITTLE_ENDIAN 34d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#define BROTLI_LITTLE_ENDIAN 35c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#endif 36c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 37c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#else 38c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 39c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#if defined(__LITTLE_ENDIAN__) 40d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#define BROTLI_LITTLE_ENDIAN 41c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#endif 42352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov#endif /* __BYTE_ORDER */ 43c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 448844b7f0d7db79aaf17ba91f0fec3ce3d90c16d4Zoltan Szabadka#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) 45d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#define BROTLI_LITTLE_ENDIAN 468844b7f0d7db79aaf17ba91f0fec3ce3d90c16d4Zoltan Szabadka#endif 478844b7f0d7db79aaf17ba91f0fec3ce3d90c16d4Zoltan Szabadka 48352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov/* Enable little-endian optimization for x64 architecture on Windows. */ 49f0b88cbcdb1983bbcd680e6f0de8a21924eb025cZoltan Szabadka#if (defined(_WIN32) || defined(_WIN64)) && defined(_M_X64) 50d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#define BROTLI_LITTLE_ENDIAN 51f0b88cbcdb1983bbcd680e6f0de8a21924eb025cZoltan Szabadka#endif 52f0b88cbcdb1983bbcd680e6f0de8a21924eb025cZoltan Szabadka 53352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov/* Portable handling of unaligned loads, stores, and copies. 54352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov On some platforms, like ARM, the copy functions can be more efficient 55352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov then a load and a store. */ 56c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 57d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#if defined(BROTLI_LITTLE_ENDIAN) && (\ 58d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov defined(ARCH_PIII) || defined(ARCH_ATHLON) || \ 59d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov defined(ARCH_K8) || defined(_ARCH_PPC)) 60c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 61352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov/* x86 and x86-64 can perform unaligned loads/stores directly; 62352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov modern PowerPC hardware can also do unaligned integer loads and stores; 63352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov but note: the FPU still sends unaligned loads and stores to a trap handler! 64352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov*/ 65c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 66b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov#define BROTLI_UNALIGNED_LOAD32(_p) (*(const uint32_t *)(_p)) 67d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#define BROTLI_UNALIGNED_LOAD64LE(_p) (*(const uint64_t *)(_p)) 68c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 69d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#define BROTLI_UNALIGNED_STORE64LE(_p, _val) \ 70b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov (*(uint64_t *)(_p) = (_val)) 71c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 72d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#elif defined(BROTLI_LITTLE_ENDIAN) && defined(__arm__) && \ 73c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_5__) && \ 74c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_5T__) && \ 75c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_5TE__) && \ 76c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_5TEJ__) && \ 77c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_6__) && \ 78c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_6J__) && \ 79c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_6K__) && \ 80c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_6Z__) && \ 81c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_6ZK__) && \ 82c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka !defined(__ARM_ARCH_6T2__) 83c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 84352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov/* ARMv7 and newer support native unaligned accesses, but only of 16-bit 85352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov and 32-bit values (not 64-bit); older versions either raise a fatal signal, 86352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov do an unaligned read and rotate the words around a bit, or do the reads very 87352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov slowly (trip through kernel mode). */ 88c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 89b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov#define BROTLI_UNALIGNED_LOAD32(_p) (*(const uint32_t *)(_p)) 90c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 91d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikovstatic BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void *p) { 92c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka uint64_t t; 93c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka memcpy(&t, p, sizeof t); 94c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka return t; 95c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka} 96c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 97d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikovstatic BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void *p, uint64_t v) { 98c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka memcpy(p, &v, sizeof v); 99c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka} 100c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 101c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#else 102c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 103352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov/* These functions are provided for architectures that don't support */ 104352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov/* unaligned loads and stores. */ 105c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 106b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikovstatic BROTLI_INLINE uint32_t BROTLI_UNALIGNED_LOAD32(const void *p) { 107c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka uint32_t t; 108c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka memcpy(&t, p, sizeof t); 109c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka return t; 110c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka} 111c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 112d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#if defined(BROTLI_LITTLE_ENDIAN) 113d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov 114d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikovstatic BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void *p) { 115c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka uint64_t t; 116c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka memcpy(&t, p, sizeof t); 117c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka return t; 118c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka} 119c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 120d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikovstatic BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void *p, uint64_t v) { 121c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka memcpy(p, &v, sizeof v); 122c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka} 123c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 124d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#else /* BROTLI_LITTLE_ENDIAN */ 125d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov 126d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikovstatic BROTLI_INLINE uint64_t BROTLI_UNALIGNED_LOAD64LE(const void *p) { 127d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov const uint8_t* in = (const uint8_t*)p; 128d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov uint64_t value = (uint64_t)(in[0]); 129d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov value |= (uint64_t)(in[1]) << 8; 130d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov value |= (uint64_t)(in[2]) << 16; 131d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov value |= (uint64_t)(in[3]) << 24; 132d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov value |= (uint64_t)(in[4]) << 32; 133d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov value |= (uint64_t)(in[5]) << 40; 134d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov value |= (uint64_t)(in[6]) << 48; 135d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov value |= (uint64_t)(in[7]) << 56; 136d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov return value; 137c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka} 138c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 139d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikovstatic BROTLI_INLINE void BROTLI_UNALIGNED_STORE64LE(void *p, uint64_t v) { 140d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov uint8_t* out = (uint8_t*)p; 141d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov out[0] = (uint8_t)v; 142d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov out[1] = (uint8_t)(v >> 8); 143d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov out[2] = (uint8_t)(v >> 16); 144d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov out[3] = (uint8_t)(v >> 24); 145d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov out[4] = (uint8_t)(v >> 32); 146d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov out[5] = (uint8_t)(v >> 40); 147d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov out[6] = (uint8_t)(v >> 48); 148d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov out[7] = (uint8_t)(v >> 56); 149d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov} 150d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov 151d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov#endif /* BROTLI_LITTLE_ENDIAN */ 152d63e8f75f5c16a6d7c8308bfd28c43cbdb6ad390Eugene Kliuchnikov 153c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka#endif 154c66e4e3e4fc3ba36ca36a43eee3b704f7b989c60Zoltan Szabadka 155801f5f37ee73c558e1944235d2a2c6fa7d7a9719Eugene Kliuchnikov#define TEMPLATE_(T) \ 156b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov static BROTLI_INLINE T brotli_min_ ## T (T a, T b) { return a < b ? a : b; } \ 157b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov static BROTLI_INLINE T brotli_max_ ## T (T a, T b) { return a > b ? a : b; } 158801f5f37ee73c558e1944235d2a2c6fa7d7a9719Eugene KliuchnikovTEMPLATE_(double) TEMPLATE_(float) TEMPLATE_(int) 159801f5f37ee73c558e1944235d2a2c6fa7d7a9719Eugene KliuchnikovTEMPLATE_(size_t) TEMPLATE_(uint32_t) TEMPLATE_(uint8_t) 160801f5f37ee73c558e1944235d2a2c6fa7d7a9719Eugene Kliuchnikov#undef TEMPLATE_ 161b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov#define BROTLI_MIN(T, A, B) (brotli_min_ ## T((A), (B))) 162b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov#define BROTLI_MAX(T, A, B) (brotli_max_ ## T((A), (B))) 163b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov 164b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov#define BROTLI_SWAP(T, A, I, J) { \ 165b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov T __brotli_swap_tmp = (A)[(I)]; \ 166b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov (A)[(I)] = (A)[(J)]; \ 167b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov (A)[(J)] = __brotli_swap_tmp; \ 168b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov} 169b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov 170b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov#define BROTLI_ENSURE_CAPACITY(M, T, A, C, R) { \ 171b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov if (C < (R)) { \ 172b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov size_t _new_size = (C == 0) ? (R) : C; \ 173b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov T* new_array; \ 174b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov while (_new_size < (R)) _new_size *= 2; \ 175b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov new_array = BROTLI_ALLOC((M), T, _new_size); \ 176e0af054d9e5a6d8b33f3779b7952ccd267cf5a85Eugene Kliuchnikov if (!BROTLI_IS_OOM(m) && C != 0) \ 177b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov memcpy(new_array, A, C * sizeof(T)); \ 178b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov BROTLI_FREE((M), A); \ 179b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov A = new_array; \ 180b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov C = _new_size; \ 181b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov } \ 182b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov} 183b972c67780f03256a3fbf81dc3350a4bf00aa4adEugene Kliuchnikov 184352b0b2836504f59c4915b20eee11a770b415a47Eugene Kliuchnikov#endif /* BROTLI_ENC_PORT_H_ */ 185