Fix build for SPARK.

This commit is contained in:
Zoltan Szabadka 2015-10-06 11:11:42 +02:00
parent 1761255c63
commit 47835c6089

View File

@ -46,6 +46,45 @@
#define __has_feature(x) 0
#endif
#if defined(__sparc)
#define BROTLI_TARGET_SPARC
#endif
#if defined(__arm__) || defined(__thumb__) || \
defined(_M_ARM) || defined(_M_ARMT)
#define BROTLI_TARGET_ARM
#if (defined(__ARM_ARCH) && (__ARM_ARCH >= 7)) || \
(defined(M_ARM) && (M_ARM >= 7))
#define BROTLI_TARGET_ARMV7
#endif /* ARMv7 */
#if defined(__aarch64__)
#define BROTLI_TARGET_ARMV8
#endif /* ARMv8 */
#endif /* ARM */
#if defined(__x86_64__) || defined(_M_X64)
#define BROTLI_TARGET_X64
#endif
#if defined(__PPC64__)
#define BROTLI_TARGET_POWERPC64
#endif
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
#define BROTLI_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
#else
#define BROTLI_GCC_VERSION 0
#endif
/* SPARC and ARMv6 don't support unaligned read.
Choose portable build for them. */
#if !defined(BROTLI_BUILD_PORTABLE)
#if defined(BROTLI_TARGET_SPARC) || \
(defined(BROTLI_TARGET_ARM) && !defined(BROTLI_TARGET_ARMV7))
#define BROTLI_BUILD_PORTABLE
#endif /* SPARK or ARMv6 */
#endif /* portable build */
#ifdef BROTLI_BUILD_PORTABLE
#define BROTLI_ALIGNED_READ 1
#define BROTLI_SAFE_MEMMOVE 1
@ -73,7 +112,7 @@ OR:
}
*/
#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || \
#if (BROTLI_GCC_VERSION > 295) || \
(defined(__llvm__) && __has_builtin(__builtin_expect))
#define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
@ -83,14 +122,14 @@ OR:
#endif
/* IS_CONSTANT macros returns true for compile-time constant expressions. */
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) || \
#if (BROTLI_GCC_VERSION > 300) || \
(defined(__llvm__) && __has_builtin(__builtin_constant_p))
#define IS_CONSTANT(x) __builtin_constant_p(x)
#else
#define IS_CONSTANT(x) 0
#endif
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) || \
#if (BROTLI_GCC_VERSION > 300) || \
(defined(__llvm__) && __has_attribute(always_inline))
#define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline))
#else
@ -118,8 +157,8 @@ OR:
#define BROTLI_64_BITS 1
#elif defined(BROTLI_BUILD_32_BIT)
#define BROTLI_64_BITS 0
#elif defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || \
defined(__PPC64__)
#elif defined(BROTLI_TARGET_X64) || defined(BROTLI_TARGET_ARMV8) || \
defined(BROTLI_TARGET_POWERPC64)
#define BROTLI_64_BITS 1
#else
#define BROTLI_64_BITS 0
@ -150,7 +189,7 @@ OR:
#define BROTLI_LITTLE_ENDIAN 0
#endif
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || \
#if (BROTLI_GCC_VERSION > 300) || \
(defined(__llvm__) && __has_attribute(noinline))
#define BROTLI_NOINLINE __attribute__ ((noinline))
#else
@ -169,8 +208,8 @@ OR:
if ((N & 4) != 0) {X; X; X; X;} \
}
#if (__GNUC__ > 2) || defined(__llvm__)
#if (defined(__ARM_ARCH) && (__ARM_ARCH >= 7))
#if (BROTLI_GCC_VERSION > 300) || defined(__llvm__)
#if defined(BROTLI_TARGET_ARMV7)
static BROTLI_INLINE unsigned BrotliRBit(unsigned input) {
unsigned output;
__asm__("rbit %0, %1\n" : "=r"(output) : "r"(input));