File indexing completed on 2025-01-18 09:54:01
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BROTLI_COMMON_PORT_H_
0010 #define BROTLI_COMMON_PORT_H_
0011
0012
0013
0014
0015
0016
0017 #define BROTLI_MAKE_VERSION(major, minor, revision) \
0018 (((major) * 1000000) + ((minor) * 1000) + (revision))
0019
0020 #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
0021 #define BROTLI_GNUC_VERSION \
0022 BROTLI_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
0023 #elif defined(__GNUC__)
0024 #define BROTLI_GNUC_VERSION BROTLI_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, 0)
0025 #endif
0026
0027 #if defined(BROTLI_GNUC_VERSION)
0028 #define BROTLI_GNUC_VERSION_CHECK(major, minor, patch) \
0029 (BROTLI_GNUC_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0030 #else
0031 #define BROTLI_GNUC_VERSION_CHECK(major, minor, patch) (0)
0032 #endif
0033
0034 #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000)
0035 #define BROTLI_MSVC_VERSION \
0036 BROTLI_MAKE_VERSION((_MSC_FULL_VER / 10000000), \
0037 (_MSC_FULL_VER % 10000000) / 100000, \
0038 (_MSC_FULL_VER % 100000) / 100)
0039 #elif defined(_MSC_FULL_VER)
0040 #define BROTLI_MSVC_VERSION \
0041 BROTLI_MAKE_VERSION((_MSC_FULL_VER / 1000000), \
0042 (_MSC_FULL_VER % 1000000) / 10000, \
0043 (_MSC_FULL_VER % 10000) / 10)
0044 #elif defined(_MSC_VER)
0045 #define BROTLI_MSVC_VERSION \
0046 BROTLI_MAKE_VERSION(_MSC_VER / 100, _MSC_VER % 100, 0)
0047 #endif
0048
0049 #if !defined(_MSC_VER)
0050 #define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) (0)
0051 #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
0052 #define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
0053 (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
0054 #elif defined(_MSC_VER) && (_MSC_VER >= 1200)
0055 #define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
0056 (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
0057 #else
0058 #define BROTLI_MSVC_VERSION_CHECK(major, minor, patch) \
0059 (_MSC_VER >= ((major * 100) + (minor)))
0060 #endif
0061
0062 #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
0063 #define BROTLI_INTEL_VERSION \
0064 BROTLI_MAKE_VERSION(__INTEL_COMPILER / 100, \
0065 __INTEL_COMPILER % 100, \
0066 __INTEL_COMPILER_UPDATE)
0067 #elif defined(__INTEL_COMPILER)
0068 #define BROTLI_INTEL_VERSION \
0069 BROTLI_MAKE_VERSION(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
0070 #endif
0071
0072 #if defined(BROTLI_INTEL_VERSION)
0073 #define BROTLI_INTEL_VERSION_CHECK(major, minor, patch) \
0074 (BROTLI_INTEL_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0075 #else
0076 #define BROTLI_INTEL_VERSION_CHECK(major, minor, patch) (0)
0077 #endif
0078
0079 #if defined(__PGI) && \
0080 defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
0081 #define BROTLI_PGI_VERSION \
0082 BROTLI_MAKE_VERSION(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
0083 #endif
0084
0085 #if defined(BROTLI_PGI_VERSION)
0086 #define BROTLI_PGI_VERSION_CHECK(major, minor, patch) \
0087 (BROTLI_PGI_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0088 #else
0089 #define BROTLI_PGI_VERSION_CHECK(major, minor, patch) (0)
0090 #endif
0091
0092 #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
0093 #define BROTLI_SUNPRO_VERSION \
0094 BROTLI_MAKE_VERSION( \
0095 (((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), \
0096 (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), \
0097 (__SUNPRO_C & 0xf) * 10)
0098 #elif defined(__SUNPRO_C)
0099 #define BROTLI_SUNPRO_VERSION \
0100 BROTLI_MAKE_VERSION((__SUNPRO_C >> 8) & 0xf, \
0101 (__SUNPRO_C >> 4) & 0xf, \
0102 (__SUNPRO_C) & 0xf)
0103 #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
0104 #define BROTLI_SUNPRO_VERSION \
0105 BROTLI_MAKE_VERSION( \
0106 (((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), \
0107 (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), \
0108 (__SUNPRO_CC & 0xf) * 10)
0109 #elif defined(__SUNPRO_CC)
0110 #define BROTLI_SUNPRO_VERSION \
0111 BROTLI_MAKE_VERSION((__SUNPRO_CC >> 8) & 0xf, \
0112 (__SUNPRO_CC >> 4) & 0xf, \
0113 (__SUNPRO_CC) & 0xf)
0114 #endif
0115
0116 #if defined(BROTLI_SUNPRO_VERSION)
0117 #define BROTLI_SUNPRO_VERSION_CHECK(major, minor, patch) \
0118 (BROTLI_SUNPRO_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0119 #else
0120 #define BROTLI_SUNPRO_VERSION_CHECK(major, minor, patch) (0)
0121 #endif
0122
0123 #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
0124 #define BROTLI_ARM_VERSION \
0125 BROTLI_MAKE_VERSION((__ARMCOMPILER_VERSION / 1000000), \
0126 (__ARMCOMPILER_VERSION % 1000000) / 10000, \
0127 (__ARMCOMPILER_VERSION % 10000) / 100)
0128 #elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
0129 #define BROTLI_ARM_VERSION \
0130 BROTLI_MAKE_VERSION((__ARMCC_VERSION / 1000000), \
0131 (__ARMCC_VERSION % 1000000) / 10000, \
0132 (__ARMCC_VERSION % 10000) / 100)
0133 #endif
0134
0135 #if defined(BROTLI_ARM_VERSION)
0136 #define BROTLI_ARM_VERSION_CHECK(major, minor, patch) \
0137 (BROTLI_ARM_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0138 #else
0139 #define BROTLI_ARM_VERSION_CHECK(major, minor, patch) (0)
0140 #endif
0141
0142 #if defined(__ibmxl__)
0143 #define BROTLI_IBM_VERSION \
0144 BROTLI_MAKE_VERSION(__ibmxl_version__, \
0145 __ibmxl_release__, \
0146 __ibmxl_modification__)
0147 #elif defined(__xlC__) && defined(__xlC_ver__)
0148 #define BROTLI_IBM_VERSION \
0149 BROTLI_MAKE_VERSION(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
0150 #elif defined(__xlC__)
0151 #define BROTLI_IBM_VERSION BROTLI_MAKE_VERSION(__xlC__ >> 8, __xlC__ & 0xff, 0)
0152 #endif
0153
0154 #if defined(BROTLI_IBM_VERSION)
0155 #define BROTLI_IBM_VERSION_CHECK(major, minor, patch) \
0156 (BROTLI_IBM_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0157 #else
0158 #define BROTLI_IBM_VERSION_CHECK(major, minor, patch) (0)
0159 #endif
0160
0161 #if defined(__TI_COMPILER_VERSION__)
0162 #define BROTLI_TI_VERSION \
0163 BROTLI_MAKE_VERSION((__TI_COMPILER_VERSION__ / 1000000), \
0164 (__TI_COMPILER_VERSION__ % 1000000) / 1000, \
0165 (__TI_COMPILER_VERSION__ % 1000))
0166 #endif
0167
0168 #if defined(BROTLI_TI_VERSION)
0169 #define BROTLI_TI_VERSION_CHECK(major, minor, patch) \
0170 (BROTLI_TI_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0171 #else
0172 #define BROTLI_TI_VERSION_CHECK(major, minor, patch) (0)
0173 #endif
0174
0175 #if defined(__IAR_SYSTEMS_ICC__)
0176 #if __VER__ > 1000
0177 #define BROTLI_IAR_VERSION \
0178 BROTLI_MAKE_VERSION((__VER__ / 1000000), \
0179 (__VER__ / 1000) % 1000, \
0180 (__VER__ % 1000))
0181 #else
0182 #define BROTLI_IAR_VERSION BROTLI_MAKE_VERSION(VER / 100, __VER__ % 100, 0)
0183 #endif
0184 #endif
0185
0186 #if defined(BROTLI_IAR_VERSION)
0187 #define BROTLI_IAR_VERSION_CHECK(major, minor, patch) \
0188 (BROTLI_IAR_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0189 #else
0190 #define BROTLI_IAR_VERSION_CHECK(major, minor, patch) (0)
0191 #endif
0192
0193 #if defined(__TINYC__)
0194 #define BROTLI_TINYC_VERSION \
0195 BROTLI_MAKE_VERSION(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
0196 #endif
0197
0198 #if defined(BROTLI_TINYC_VERSION)
0199 #define BROTLI_TINYC_VERSION_CHECK(major, minor, patch) \
0200 (BROTLI_TINYC_VERSION >= BROTLI_MAKE_VERSION(major, minor, patch))
0201 #else
0202 #define BROTLI_TINYC_VERSION_CHECK(major, minor, patch) (0)
0203 #endif
0204
0205 #if defined(__has_attribute)
0206 #define BROTLI_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
0207 __has_attribute(attribute)
0208 #else
0209 #define BROTLI_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) \
0210 BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
0211 #endif
0212
0213 #if defined(__has_builtin)
0214 #define BROTLI_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
0215 __has_builtin(builtin)
0216 #else
0217 #define BROTLI_GNUC_HAS_BUILTIN(builtin, major, minor, patch) \
0218 BROTLI_GNUC_VERSION_CHECK(major, minor, patch)
0219 #endif
0220
0221 #if defined(__has_feature)
0222 #define BROTLI_HAS_FEATURE(feature) __has_feature(feature)
0223 #else
0224 #define BROTLI_HAS_FEATURE(feature) (0)
0225 #endif
0226
0227 #if defined(_WIN32) || defined(__CYGWIN__)
0228 #define BROTLI_PUBLIC
0229 #elif BROTLI_GNUC_VERSION_CHECK(3, 3, 0) || \
0230 BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
0231 BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
0232 BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
0233 BROTLI_IBM_VERSION_CHECK(13, 1, 0) || \
0234 BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \
0235 (BROTLI_TI_VERSION_CHECK(7, 3, 0) && \
0236 defined(__TI_GNU_ATTRIBUTE_SUPPORT__) && defined(__TI_EABI__))
0237 #define BROTLI_PUBLIC __attribute__ ((visibility ("default")))
0238 #else
0239 #define BROTLI_PUBLIC
0240 #endif
0241
0242
0243 #if !defined(BROTLI_INTERNAL)
0244 #if defined(_WIN32) || defined(__CYGWIN__)
0245 #define BROTLI_INTERNAL
0246 #elif BROTLI_GNUC_VERSION_CHECK(3, 3, 0) || \
0247 BROTLI_TI_VERSION_CHECK(8, 0, 0) || \
0248 BROTLI_INTEL_VERSION_CHECK(16, 0, 0) || \
0249 BROTLI_ARM_VERSION_CHECK(4, 1, 0) || \
0250 BROTLI_IBM_VERSION_CHECK(13, 1, 0) || \
0251 BROTLI_SUNPRO_VERSION_CHECK(5, 11, 0) || \
0252 (BROTLI_TI_VERSION_CHECK(7, 3, 0) && \
0253 defined(__TI_GNU_ATTRIBUTE_SUPPORT__) && defined(__TI_EABI__))
0254 #define BROTLI_INTERNAL __attribute__ ((visibility ("hidden")))
0255 #else
0256 #define BROTLI_INTERNAL
0257 #endif
0258 #endif
0259
0260 #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
0261 !defined(__STDC_NO_VLA__) && !defined(__cplusplus) && \
0262 !defined(__PGI) && !defined(__PGIC__) && !defined(__TINYC__) && \
0263 !defined(__clang__)
0264 #define BROTLI_ARRAY_PARAM(name) (name)
0265 #else
0266 #define BROTLI_ARRAY_PARAM(name)
0267 #endif
0268
0269
0270
0271 #if defined(BROTLI_SHARED_COMPILATION)
0272 #if defined(_WIN32)
0273 #if defined(BROTLICOMMON_SHARED_COMPILATION)
0274 #define BROTLI_COMMON_API __declspec(dllexport)
0275 #else
0276 #define BROTLI_COMMON_API __declspec(dllimport)
0277 #endif
0278 #if defined(BROTLIDEC_SHARED_COMPILATION)
0279 #define BROTLI_DEC_API __declspec(dllexport)
0280 #else
0281 #define BROTLI_DEC_API __declspec(dllimport)
0282 #endif
0283 #if defined(BROTLIENC_SHARED_COMPILATION)
0284 #define BROTLI_ENC_API __declspec(dllexport)
0285 #else
0286 #define BROTLI_ENC_API __declspec(dllimport)
0287 #endif
0288 #else
0289 #define BROTLI_COMMON_API BROTLI_PUBLIC
0290 #define BROTLI_DEC_API BROTLI_PUBLIC
0291 #define BROTLI_ENC_API BROTLI_PUBLIC
0292 #endif
0293 #else
0294 #define BROTLI_COMMON_API
0295 #define BROTLI_DEC_API
0296 #define BROTLI_ENC_API
0297 #endif
0298
0299 #if defined(BROTLI_BUILD_ENC_EXTRA_API)
0300 #define BROTLI_ENC_EXTRA_API BROTLI_ENC_API
0301 #else
0302 #define BROTLI_ENC_EXTRA_API BROTLI_INTERNAL
0303 #endif
0304
0305 #endif