LameXP/etc/Patches/FAAD-v2.8.6-Win32-ByteSwap-Fix.diff

41 lines
863 B
Diff
Raw Normal View History

frontend/mp4read.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/frontend/mp4read.c b/frontend/mp4read.c
index 9d92bf5..c8ca530 100644
--- a/frontend/mp4read.c
+++ b/frontend/mp4read.c
@@ -45,17 +45,29 @@ mp4config_t mp4config = { 0 };
static FILE *g_fin = NULL;
-static inline uint32_t bswap32(uint32_t u32)
+static inline uint32_t bswap32(const uint32_t u32)
{
#ifndef WORDS_BIGENDIAN
+#ifdef _MSC_VER
+ return _byteswap_ulong(u32);
+#else
return __builtin_bswap32(u32);
#endif
+#else
+ return u32;
+#endif
}
-static inline uint16_t bswap16(uint16_t u16)
+static inline uint16_t bswap16(const uint16_t u16)
{
#ifndef WORDS_BIGENDIAN
- return __builtin_bswap16(u16);
+#ifdef _MSC_VER
+ return _byteswap_ushort(u16);
+#else
+ return __builtin_bswap16(u16);
+#endif
+#else
+ return u16;
#endif
}