summaryrefslogtreecommitdiffstats
path: root/osdep/endian.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:36:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:36:56 +0000
commit51de1d8436100f725f3576aefa24a2bd2057bc28 (patch)
treec6d1d5264b6d40a8d7ca34129f36b7d61e188af3 /osdep/endian.h
parentInitial commit. (diff)
downloadmpv-51de1d8436100f725f3576aefa24a2bd2057bc28.tar.xz
mpv-51de1d8436100f725f3576aefa24a2bd2057bc28.zip
Adding upstream version 0.37.0.upstream/0.37.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'osdep/endian.h')
-rw-r--r--osdep/endian.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/osdep/endian.h b/osdep/endian.h
new file mode 100644
index 0000000..c6d1376
--- /dev/null
+++ b/osdep/endian.h
@@ -0,0 +1,37 @@
+#ifndef MP_ENDIAN_H_
+#define MP_ENDIAN_H_
+
+#include <sys/types.h>
+
+#if !defined(BYTE_ORDER)
+
+#if defined(__BYTE_ORDER)
+#define BYTE_ORDER __BYTE_ORDER
+#define LITTLE_ENDIAN __LITTLE_ENDIAN
+#define BIG_ENDIAN __BIG_ENDIAN
+#elif defined(__DARWIN_BYTE_ORDER)
+#define BYTE_ORDER __DARWIN_BYTE_ORDER
+#define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
+#define BIG_ENDIAN __DARWIN_BIG_ENDIAN
+#else
+#include <libavutil/bswap.h>
+#if AV_HAVE_BIGENDIAN
+#define BYTE_ORDER 1234
+#define LITTLE_ENDIAN 4321
+#define BIG_ENDIAN 1234
+#else
+#define BYTE_ORDER 1234
+#define LITTLE_ENDIAN 1234
+#define BIG_ENDIAN 4321
+#endif
+#endif
+
+#endif /* !defined(BYTE_ORDER) */
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define MP_SELECT_LE_BE(LE, BE) BE
+#else
+#define MP_SELECT_LE_BE(LE, BE) LE
+#endif
+
+#endif