mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-25 22:24:16 +00:00
Fix unaligned access when built by clang
This commit is contained in:
parent
80593d29bd
commit
617d75545f
@ -2228,22 +2228,22 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou
|
|||||||
*( (EOFFSET *)pOutputData ) = 0;
|
*( (EOFFSET *)pOutputData ) = 0;
|
||||||
break;
|
break;
|
||||||
case FIELD_VECTOR:
|
case FIELD_VECTOR:
|
||||||
|
#ifdef __VFP_FP__
|
||||||
|
memcpy( pOutputData, pInputData, sizeof( Vector ) );
|
||||||
|
#else
|
||||||
( (float *)pOutputData )[0] = ( (float *)pInputData )[0];
|
( (float *)pOutputData )[0] = ( (float *)pInputData )[0];
|
||||||
( (float *)pOutputData )[1] = ( (float *)pInputData )[1];
|
( (float *)pOutputData )[1] = ( (float *)pInputData )[1];
|
||||||
( (float *)pOutputData )[2] = ( (float *)pInputData )[2];
|
( (float *)pOutputData )[2] = ( (float *)pInputData )[2];
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case FIELD_POSITION_VECTOR:
|
case FIELD_POSITION_VECTOR:
|
||||||
#ifdef __VFP_FP__
|
#ifdef __VFP_FP__
|
||||||
float tmp;
|
{
|
||||||
memcpy( &tmp, (char *)pInputData + 0, 4 );
|
Vector tmp;
|
||||||
tmp += position.x;
|
memcpy( &tmp, pInputData, sizeof( Vector ) );
|
||||||
memcpy( (char *)pOutputData + 0, &tmp, 4 );
|
tmp += position;
|
||||||
memcpy( &tmp, (char *)pInputData + 4, 4 );
|
memcpy( pOutputData, &tmp, sizeof( Vector ) );
|
||||||
tmp += position.y;
|
}
|
||||||
memcpy( (char *)pOutputData + 4, &tmp, 4 );
|
|
||||||
memcpy( &tmp, (char *)pInputData + 8, 4 );
|
|
||||||
tmp += position.z;
|
|
||||||
memcpy( (char *)pOutputData + 8, &tmp, 4 );
|
|
||||||
#else
|
#else
|
||||||
( (float *)pOutputData )[0] = ( (float *)pInputData )[0] + position.x;
|
( (float *)pOutputData )[0] = ( (float *)pInputData )[0] + position.x;
|
||||||
( (float *)pOutputData )[1] = ( (float *)pInputData )[1] + position.y;
|
( (float *)pOutputData )[1] = ( (float *)pInputData )[1] + position.y;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user