aboutsummaryrefslogtreecommitdiff
path: root/iDSK/src/endianPPC.cpp
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2025-02-01 08:50:40 +0000
committerJuan J. Martinez <jjm@usebox.net>2025-02-01 08:50:40 +0000
commit6cb4b6673e8e5aa5c0101e179cc7afcdcf07236c (patch)
tree9e304cb4abbbedc0dcb323d8fd95bf1b192b691b /iDSK/src/endianPPC.cpp
downloadpc-cpc-basic-6cb4b6673e8e5aa5c0101e179cc7afcdcf07236c.tar.gz
pc-cpc-basic-6cb4b6673e8e5aa5c0101e179cc7afcdcf07236c.zip
Initial import
Diffstat (limited to 'iDSK/src/endianPPC.cpp')
-rw-r--r--iDSK/src/endianPPC.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/iDSK/src/endianPPC.cpp b/iDSK/src/endianPPC.cpp
new file mode 100644
index 0000000..f3146d6
--- /dev/null
+++ b/iDSK/src/endianPPC.cpp
@@ -0,0 +1,24 @@
+#include <iostream>
+#include <cstdlib>
+using namespace std;
+#include "endianPPC.h"
+
+#ifndef _MSC_VER
+#include <sys/param.h>
+#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__MORPHOS__)
+#include <machine/endian.h>
+#else
+#include <endian.h>
+#endif
+#endif
+
+bool isBigEndian(void)
+{
+#ifdef BYTE_ORDER
+ return BYTE_ORDER == BIG_ENDIAN;
+#elif defined _MSC_VER
+ return false; // Modern VC++ only runs on x86, x64 and ARM, doesn't require big/little endian conversion
+#else
+ return __BYTE_ORDER == __BIG_ENDIAN;
+#endif
+}