Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Mar 2005 19:08:28 +0200
From:      Andriy Gapon <avg@icyb.net.ua>
To:        freebsd-sparc64@freebsd.org
Subject:   udfclient-0.3.3_1 failed on sparc64: bswap.h
Message-ID:  <4241A28C.4060309@icyb.net.ua>
In-Reply-To: <42415375.4080107@icyb.net.ua>
References:  <42415375.4080107@icyb.net.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030109070305070303040201
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit


Volunteers with big endian hardware, could you please test the attached
patch to sysutils/udfclient port? At least that it compiles, it is only
a few .c files.

-- 
Andriy Gapon

--------------030109070305070303040201
Content-Type: text/plain;
 name="sparc.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="sparc.patch"

--- ./work/UDFclient.0.3.3/udf_bswap.h.orig	Wed Mar 23 18:00:36 2005
+++ ./work/UDFclient.0.3.3/udf_bswap.h	Wed Mar 23 19:00:10 2005
@@ -52,8 +52,33 @@
 /* rest only relevant for big endian machines */
 #if (BYTE_ORDER == BIG_ENDIAN)
 
+#if !defined(__FreeBSD__)
 #include <machine/bswap.h>
 #include <sys/bswap.h>
+#else
+#if !defined(bswap16)
+/* this version of FreeBSD does not provide bswap*() functions */
+static __inline u_int16_t
+bswap16(u_int16_t x)
+{
+	return ((x >> 8) | ((x << 8) & 0xff00U));
+}
+static __inline u_int32_t
+bswap32(u_int32_t x)
+{
+	return ((x >> 24) | ((x >> 8) & 0xff00U) | ((x << 8) & 0xff0000U) |
+	    ((x << 24) & 0xff000000U));
+}
+static __inline u_int64_t
+bswap64(u_int64_t x)
+{
+	return ((x >> 56) | ((x >> 40) & 0xff00UL) | ((x >> 24) & 0xff0000UL) |
+	    ((x >> 8) & 0xff000000UL) | ((x << 8) & 0xff00000000UL) |
+	    ((x << 24) & 0xff0000000000UL) | ((x << 40) & 0xff000000000000UL) |
+	    ((x << 56)));
+}
+#endif
+#endif
 
 /* inlines for access to swapped data */
 static __inline u_int16_t udf_rw16 __P((u_int16_t));

--------------030109070305070303040201--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4241A28C.4060309>