aboutsummaryrefslogtreecommitdiff
path: root/tools/iDSK/src/endianPPC.cpp
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-11-05 11:22:55 +0000
committerJuan J. Martinez <jjm@usebox.net>2023-11-05 11:31:28 +0000
commit2fbdf974338bde8576efdae40a819a76b2391033 (patch)
tree64d41a37470143f142344f9a439d96de3e7918c2 /tools/iDSK/src/endianPPC.cpp
downloadkitsunes-curse-2fbdf974338bde8576efdae40a819a76b2391033.tar.gz
kitsunes-curse-2fbdf974338bde8576efdae40a819a76b2391033.zip
Initial import of the open source release
Diffstat (limited to 'tools/iDSK/src/endianPPC.cpp')
-rw-r--r--tools/iDSK/src/endianPPC.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/iDSK/src/endianPPC.cpp b/tools/iDSK/src/endianPPC.cpp
new file mode 100644
index 0000000..f3146d6
--- /dev/null
+++ b/tools/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
+}