Yet improve support for FreeBSD optimized byteswap routines

This commit is contained in:
Mario Sergio Fujikawa Ferreira 2004-11-14 03:54:44 +00:00
parent 40cdf8297a
commit cdd19ce367
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=121535

View file

@ -1,10 +1,12 @@
--- dvdread/bswap.h.orig Wed Mar 5 23:13:17 2003
+++ dvdread/bswap.h Wed Mar 5 23:14:24 2003
@@ -57,7 +57,15 @@
--- dvdread/bswap.h.orig Sat Nov 13 17:18:54 2004
+++ dvdread/bswap.h Sat Nov 13 18:01:26 2004
@@ -57,7 +57,19 @@
#include <sys/endian.h>
#define B2N_16(x) x = be16toh(x)
#define B2N_32(x) x = be32toh(x)
-#define B2N_64(x) x = be64toh(x)
+# if __FreeBSD_version >= 510000
#define B2N_64(x) x = be64toh(x)
+# else
+#define B2N_64(x) x = \
+ x = ((((x) & 0xff00000000000000) >> 56) | \
+ (((x) & 0x00ff000000000000) >> 40) | \
@ -14,6 +16,7 @@
+ (((x) & 0x0000000000ff0000) << 24) | \
+ (((x) & 0x000000000000ff00) << 40) | \
+ (((x) & 0x00000000000000ff) << 56))
+# endif
/* This is a slow but portable implementation, it has multiple evaluation
* problems so beware.