summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-arch/unace/files/unace-1.2b-aliasing.patch')
-rw-r--r--app-arch/unace/files/unace-1.2b-aliasing.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/app-arch/unace/files/unace-1.2b-aliasing.patch b/app-arch/unace/files/unace-1.2b-aliasing.patch
new file mode 100644
index 000000000000..ccd7f57c4f98
--- /dev/null
+++ b/app-arch/unace/files/unace-1.2b-aliasing.patch
@@ -0,0 +1,20 @@
+--- a/portable.h
++++ b/portable.h
+@@ -79,11 +79,13 @@
+
+ #else /* HI_LO_BYTE_ORDER */
+
+-#define BUFP2WORD(p) *(UWORD*)((p+=2)-2)
+-#define BUFP2LONG(p) *(ULONG*)((p+=4)-4)
++#define _MAGIC_UNION(type, p) ({ union { UCHAR *_c; type *_u; } _x = { ._c = (p) }; *_x._u; })
+
+-#define BUF2WORD(p) (*(UWORD*)p)
+-#define BUF2LONG(p) (*(ULONG*)p)
++#define BUFP2WORD(p) _MAGIC_UNION(UWORD, ((p+=2)-2))
++#define BUFP2LONG(p) _MAGIC_UNION(ULONG, ((p+=4)-4))
++
++#define BUF2WORD(p) _MAGIC_UNION(UWORD, p)
++#define BUF2LONG(p) _MAGIC_UNION(ULONG, p)
+
+ #endif /* !HI_LO_BYTE_ORDER */
+