summaryrefslogtreecommitdiffstats
path: root/dvdread/bswap.h
diff options
context:
space:
mode:
Diffstat (limited to 'dvdread/bswap.h')
-rw-r--r--dvdread/bswap.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/dvdread/bswap.h b/dvdread/bswap.h
index c612025b31..a5296b82cd 100644
--- a/dvdread/bswap.h
+++ b/dvdread/bswap.h
@@ -61,7 +61,19 @@
#include <sys/endian.h>
#define B2N_16(x) x = be16toh(x)
#define B2N_32(x) x = be32toh(x)
+#if __FreeBSD_version >= 500000
#define B2N_64(x) x = be64toh(x)
+#else
+#define B2N_64(x) \
+ x = ((((x) & 0xff00000000000000) >> 56) | \
+ (((x) & 0x00ff000000000000) >> 40) | \
+ (((x) & 0x0000ff0000000000) >> 24) | \
+ (((x) & 0x000000ff00000000) >> 8) | \
+ (((x) & 0x00000000ff000000) << 8) | \
+ (((x) & 0x0000000000ff0000) << 24) | \
+ (((x) & 0x000000000000ff00) << 40) | \
+ (((x) & 0x00000000000000ff) << 56))
+#endif /* _FreeBSD_version >= 500000 */
#elif defined(__DragonFly__)
#include <sys/endian.h>
@@ -113,7 +125,7 @@ inline static unsigned long long int bswap_64(unsigned long long int x)
* functionality!
*/
-#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(__CYGWIN__)
+#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined(__BEOS__) || defined(__INTERIX) || defined(__CYGWIN__)
#define B2N_16(x) \
x = ((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))