aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-12-06 23:11:25 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-12-06 23:11:25 +0000
commitf013a038dda405d44f8c17cbd2cdf5827666c193 (patch)
tree4e05773e3b71f21ea3a4de128710d26ca05be5a5 /code
parentb6f5f627941168150af7e55e519a7cf421afdbee (diff)
downloadioquake3-aero-f013a038dda405d44f8c17cbd2cdf5827666c193.tar.gz
ioquake3-aero-f013a038dda405d44f8c17cbd2cdf5827666c193.zip
use memcpy for copying stuff around to fix alignment problems
git-svn-id: svn://svn.icculus.org/quake3/trunk@434 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r--code/client/cl_cin.c116
1 files changed, 34 insertions, 82 deletions
diff --git a/code/client/cl_cin.c b/code/client/cl_cin.c
index e15f4a7..3b75c2e 100644
--- a/code/client/cl_cin.c
+++ b/code/client/cl_cin.c
@@ -333,28 +333,14 @@ long RllDecodeStereoToMono(unsigned char *from,short *to,unsigned int size,char
static void move8_32( byte *src, byte *dst, int spl )
{
- double *dsrc, *ddst;
- int dspl;
-
- dsrc = (double *)src;
- ddst = (double *)dst;
- dspl = spl>>3;
-
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
+ int i;
+
+ for(i = 0; i < 8; ++i)
+ {
+ memcpy(dst, src, 32);
+ src += spl;
+ dst += spl;
+ }
}
/******************************************************************************
@@ -367,20 +353,14 @@ static void move8_32( byte *src, byte *dst, int spl )
static void move4_32( byte *src, byte *dst, int spl )
{
- double *dsrc, *ddst;
- int dspl;
-
- dsrc = (double *)src;
- ddst = (double *)dst;
- dspl = spl>>3;
-
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1];
- dsrc += dspl; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1];
+ int i;
+
+ for(i = 0; i < 4; ++i)
+ {
+ memcpy(dst, src, 16);
+ src += spl;
+ dst += spl;
+ }
}
/******************************************************************************
@@ -393,28 +373,14 @@ static void move4_32( byte *src, byte *dst, int spl )
static void blit8_32( byte *src, byte *dst, int spl )
{
- double *dsrc, *ddst;
- int dspl;
-
- dsrc = (double *)src;
- ddst = (double *)dst;
- dspl = spl>>3;
-
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += 4; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += 4; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += 4; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += 4; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += 4; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += 4; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
- dsrc += 4; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1]; ddst[2] = dsrc[2]; ddst[3] = dsrc[3];
+ int i;
+
+ for(i = 0; i < 8; ++i)
+ {
+ memcpy(dst, src, 32);
+ src += 32;
+ dst += spl;
+ }
}
/******************************************************************************
@@ -424,23 +390,16 @@ static void blit8_32( byte *src, byte *dst, int spl )
* Description:
*
******************************************************************************/
-#define movs double
static void blit4_32( byte *src, byte *dst, int spl )
{
- movs *dsrc, *ddst;
- int dspl;
-
- dsrc = (movs *)src;
- ddst = (movs *)dst;
- dspl = spl>>3;
-
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1];
- dsrc += 2; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1];
- dsrc += 2; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1];
- dsrc += 2; ddst += dspl;
- ddst[0] = dsrc[0]; ddst[1] = dsrc[1];
+ int i;
+
+ for(i = 0; i < 4; ++i)
+ {
+ memmove(dst, src, 16);
+ src += 16;
+ dst += spl;
+ }
}
/******************************************************************************
@@ -453,15 +412,8 @@ static void blit4_32( byte *src, byte *dst, int spl )
static void blit2_32( byte *src, byte *dst, int spl )
{
- double *dsrc, *ddst;
- int dspl;
-
- dsrc = (double *)src;
- ddst = (double *)dst;
- dspl = spl>>3;
-
- ddst[0] = dsrc[0];
- ddst[dspl] = dsrc[1];
+ memcpy(dst, src, 8);
+ memcpy(dst+spl, src+8, 8);
}
/******************************************************************************