summaryrefslogtreecommitdiff
path: root/src/qcommon/q_shared.c
diff options
context:
space:
mode:
authorThilo Schulz <arny@ats.s.bawue.de>2011-07-17 01:41:39 +0000
committerTim Angus <tim@ngus.net>2013-01-10 22:30:00 +0000
commit8573ded969056c0029e1103944b60f8dc472f185 (patch)
tree037ca502b6600ac444f83fe3b815d23aaa4ed5c3 /src/qcommon/q_shared.c
parent3155cba037535b8a703498f85ec9ad5e1d6f2f52 (diff)
Fix alignment issues in message sending/reading that would crash IRIX, thanks to Canavan for supplying a shell where I could fix this (#5077)
Diffstat (limited to 'src/qcommon/q_shared.c')
-rw-r--r--src/qcommon/q_shared.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c
index d6aa5c90..d8bc7383 100644
--- a/src/qcommon/q_shared.c
+++ b/src/qcommon/q_shared.c
@@ -130,6 +130,24 @@ float BigFloat (const float *l) {return _BigFloat(l);}
float LittleFloat (const float *l) {return _LittleFloat(l);}
*/
+void CopyShortSwap(void *dest, void *src)
+{
+ byte *to = dest, *from = src;
+
+ to[0] = from[1];
+ to[1] = from[0];
+}
+
+void CopyLongSwap(void *dest, void *src)
+{
+ byte *to = dest, *from = src;
+
+ to[0] = from[3];
+ to[1] = from[2];
+ to[2] = from[1];
+ to[3] = from[0];
+}
+
short ShortSwap (short l)
{
byte b1,b2;