From 917d24aaec9fa3a8fc9b00c171c0935297044a43 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Mon, 3 Nov 2003 00:10:05 +0000
Subject: [PATCH] Added cpuwrap.h for big endian processors byte-swapping
 macros.

More OS/X mods.
---
 src/xpdev/cpuwrap.h | 11 +++++++++++
 src/xpdev/genwrap.c |  2 ++
 2 files changed, 13 insertions(+)
 create mode 100644 src/xpdev/cpuwrap.h

diff --git a/src/xpdev/cpuwrap.h b/src/xpdev/cpuwrap.h
new file mode 100644
index 0000000000..1fa349221c
--- /dev/null
+++ b/src/xpdev/cpuwrap.h
@@ -0,0 +1,11 @@
+#ifdef __BIG_ENDIAN__
+#define htols(hval)	((((ushort)(hval) & 0xff00)>>8)|(((ushort)(hval) & 0x00ff)<<8))
+#define ltohs(lval)	((((ushort)(lval) & 0xff00)>>8)|(((ushort)(lval) & 0x00ff)<<8))
+#define htoll(hval)	((((ulong)(hval) & 0xff000000)>>24)|(((ulong)(hval) & 0x00ff0000)>>8)|(((ulong)(hval) & 0x0000ff00)<<8)|(((ulong)(hval) & 0x000000ff)<<24))
+#define ltohl(lval)	((((ulong)(lval) & 0xff000000)>>24)|(((ulong)(lval) & 0x00ff0000)>>8)|(((ulong)(lval) & 0x0000ff00)<<8)|(((ulong)(lval) & 0x000000ff)<<24))
+#else
+#define htols(x)	(x)
+#define ltohs(x)	(x)
+#define htoll(x)	(x)
+#define ltohl(x)	(x)
+#endif
diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c
index 5ecaae91e3..f8e7a9df97 100644
--- a/src/xpdev/genwrap.c
+++ b/src/xpdev/genwrap.c
@@ -142,6 +142,7 @@ void DLLCALL unix_beep(int freq, int dur)
 {
 	static int console_fd=-1;
 
+#if !defined(__OpenBSD__) && !defined(__GNU__) && !defined(__NetBSD__) && !defined(__QNX__)
 #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
 	int speaker_fd=-1;
 	tone_t tone;
@@ -175,6 +176,7 @@ void DLLCALL unix_beep(int freq, int dur)
 #endif /* solaris */
 	}
 #endif
+#endif /* Nasty Kludge */
 }
 #endif
 
-- 
GitLab