remove dependency on os-specific defines

PiperOrigin-RevId: 600449944
This commit is contained in:
Evgenii Kliuchnikov 2024-01-22 07:24:07 -08:00 committed by Copybara-Service
parent adbc354d23
commit d5e697b3c7

View File

@ -29,17 +29,7 @@
#include <brotli/port.h> #include <brotli/port.h>
#include <brotli/types.h> #include <brotli/types.h>
#if defined(OS_LINUX) || defined(OS_CYGWIN) || defined(__EMSCRIPTEN__) #include <sys/types.h> /* should include endian.h for us */
#include <endian.h>
#elif defined(OS_FREEBSD)
#include <machine/endian.h>
#elif defined(OS_MACOSX)
#include <machine/endian.h>
/* Let's try and follow the Linux convention */
#define BROTLI_X_BYTE_ORDER BYTE_ORDER
#define BROTLI_X_LITTLE_ENDIAN LITTLE_ENDIAN
#define BROTLI_X_BIG_ENDIAN BIG_ENDIAN
#endif
#if BROTLI_MSVC_VERSION_CHECK(18, 0, 0) #if BROTLI_MSVC_VERSION_CHECK(18, 0, 0)
#include <intrin.h> #include <intrin.h>
@ -248,13 +238,12 @@ OR:
#define BROTLI_LITTLE_ENDIAN 1 #define BROTLI_LITTLE_ENDIAN 1
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) #elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define BROTLI_BIG_ENDIAN 1 #define BROTLI_BIG_ENDIAN 1
#elif defined(BROTLI_X_BYTE_ORDER) /* Likely target platform is iOS / OSX. */
#if BROTLI_X_BYTE_ORDER == BROTLI_X_LITTLE_ENDIAN #elif defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
#define BROTLI_LITTLE_ENDIAN 1 #define BROTLI_LITTLE_ENDIAN 1
#elif BROTLI_X_BYTE_ORDER == BROTLI_X_BIG_ENDIAN #elif defined(BYTE_ORDER) && (BYTE_ORDER == BIG_ENDIAN)
#define BROTLI_BIG_ENDIAN 1 #define BROTLI_BIG_ENDIAN 1
#endif #endif
#endif /* BROTLI_X_BYTE_ORDER */
#if !defined(BROTLI_LITTLE_ENDIAN) #if !defined(BROTLI_LITTLE_ENDIAN)
#define BROTLI_LITTLE_ENDIAN 0 #define BROTLI_LITTLE_ENDIAN 0
@ -264,12 +253,6 @@ OR:
#define BROTLI_BIG_ENDIAN 0 #define BROTLI_BIG_ENDIAN 0
#endif #endif
#if defined(BROTLI_X_BYTE_ORDER)
#undef BROTLI_X_BYTE_ORDER
#undef BROTLI_X_LITTLE_ENDIAN
#undef BROTLI_X_BIG_ENDIAN
#endif
#if defined(BROTLI_BUILD_NO_UNALIGNED_READ_FAST) #if defined(BROTLI_BUILD_NO_UNALIGNED_READ_FAST)
#define BROTLI_UNALIGNED_READ_FAST (!!0) #define BROTLI_UNALIGNED_READ_FAST (!!0)
#elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) || \ #elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) || \