aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgenii Kliuchnikov <eustas@google.com>2024-01-22 07:24:07 -0800
committerCopybara-Service <copybara-worker@google.com>2024-01-22 07:24:41 -0800
commitd5e697b3c7d57cc98ea83b044a8215013b0e1e15 (patch)
tree9cec1ae0e8154080d479924d9c073326d138fc3f
parentadbc354d23af714a557730cc0e15fc38909e4ef0 (diff)
downloadbrotli-d5e697b3c7d57cc98ea83b044a8215013b0e1e15.zip
brotli-d5e697b3c7d57cc98ea83b044a8215013b0e1e15.tar.gz
brotli-d5e697b3c7d57cc98ea83b044a8215013b0e1e15.tar.bz2
remove dependency on os-specific defines
PiperOrigin-RevId: 600449944
-rw-r--r--c/common/platform.h25
1 files changed, 4 insertions, 21 deletions
diff --git a/c/common/platform.h b/c/common/platform.h
index f66a6cb..dbba942 100644
--- a/c/common/platform.h
+++ b/c/common/platform.h
@@ -29,17 +29,7 @@
#include <brotli/port.h>
#include <brotli/types.h>
-#if defined(OS_LINUX) || defined(OS_CYGWIN) || defined(__EMSCRIPTEN__)
-#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
+#include <sys/types.h> /* should include endian.h for us */
#if BROTLI_MSVC_VERSION_CHECK(18, 0, 0)
#include <intrin.h>
@@ -248,13 +238,12 @@ OR:
#define BROTLI_LITTLE_ENDIAN 1
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
#define BROTLI_BIG_ENDIAN 1
-#elif defined(BROTLI_X_BYTE_ORDER)
-#if BROTLI_X_BYTE_ORDER == BROTLI_X_LITTLE_ENDIAN
+/* Likely target platform is iOS / OSX. */
+#elif defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
#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
#endif
-#endif /* BROTLI_X_BYTE_ORDER */
#if !defined(BROTLI_LITTLE_ENDIAN)
#define BROTLI_LITTLE_ENDIAN 0
@@ -264,12 +253,6 @@ OR:
#define BROTLI_BIG_ENDIAN 0
#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)
#define BROTLI_UNALIGNED_READ_FAST (!!0)
#elif defined(BROTLI_TARGET_X86) || defined(BROTLI_TARGET_X64) || \