aboutsummaryrefslogtreecommitdiff
path: root/tools/iDSK/src/endianPPC.h
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2021-05-03 08:21:10 +0100
committerJuan J. Martinez <jjm@usebox.net>2021-05-03 10:00:00 +0100
commitc3b0fa04a663fe233765b83d3be41a42aa08c25d (patch)
tree0befda349001ef6ce306b39378f9c70ad917363e /tools/iDSK/src/endianPPC.h
downloadreturn-of-traxtor-cpc-c3b0fa04a663fe233765b83d3be41a42aa08c25d.tar.gz
return-of-traxtor-cpc-c3b0fa04a663fe233765b83d3be41a42aa08c25d.zip
Initial import for public releaseHEADmain
Diffstat (limited to 'tools/iDSK/src/endianPPC.h')
-rw-r--r--tools/iDSK/src/endianPPC.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/iDSK/src/endianPPC.h b/tools/iDSK/src/endianPPC.h
new file mode 100644
index 0000000..9def637
--- /dev/null
+++ b/tools/iDSK/src/endianPPC.h
@@ -0,0 +1,22 @@
+#ifndef __ENDIANPPC_H__
+#define __ENDIANPPC_H__
+
+/* macros convertion little endian convertion to big endian convertion */
+
+
+#define SWAP_2(x) ( (((x) & 0xff) << 8) | ((unsigned short)(x) >> 8) )
+#define SWAP_4(x) ( ((x) << 24) | \
+ (((x) << 8) & 0x00ff0000) | \
+ (((x) >> 8) & 0x0000ff00) | \
+ ((x) >> 24) )
+#define FIX_SHORT(x) (*(unsigned short *)&(x) = SWAP_2(*(unsigned short *)&(x)))
+#define FIX_INT(x) (*(unsigned int *)&(x) = SWAP_4(*(unsigned int *)&(x)))
+#define FIX_FLOAT(x) FIX_INT(x)
+
+
+
+/* endianness test function */
+
+bool isBigEndian(void);
+
+#endif