about summary refs log tree commit diff
path: root/lib/util/wordaccess_be_unaligned.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util/wordaccess_be_unaligned.h')
-rw-r--r--lib/util/wordaccess_be_unaligned.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/util/wordaccess_be_unaligned.h b/lib/util/wordaccess_be_unaligned.h
new file mode 100644
index 00000000..95b68ac7
--- /dev/null
+++ b/lib/util/wordaccess_be_unaligned.h
@@ -0,0 +1,20 @@
+/*=============================================================================
+  This file is the part of wordaccess.h for use on a big-endian machine
+  that does not require word accesses to be word-aligned.
+*===========================================================================*/
+
+typedef unsigned long int wordint;
+typedef unsigned char wordintBytes[sizeof(wordint)];
+
+static __inline__ wordint
+bytesToWordint(wordintBytes bytes) {
+    return *((wordint *)bytes);
+}
+
+
+
+static __inline__ void
+wordintToBytes(wordintBytes * const bytesP,
+               wordint        const wordInt) {
+    *(wordint *)bytesP = wordInt;
+}