WIP: fix some memaccess-class warnings

This commit is contained in:
nillerusr
2022-11-16 13:28:39 +03:00
parent 8fbc002a37
commit db3062c60b
12 changed files with 78 additions and 35 deletions

View File

@@ -20,6 +20,7 @@
#include "tier0/dbg.h"
#include "tier1/utlsoacontainer.h"
#include "mathlib/ssemath.h"
#include "tier1/memhelpers.h"
class CSIMDVectorMatrix
{
@@ -61,19 +62,19 @@ public:
// set up storage and fields for m x n matrix. destroys old data
void SetSize( int width, int height )
{
if ( ( ! m_pData ) || ( width != m_nWidth ) || ( height != m_nHeight ) )
if ( ( ! m_pData ) || ( width > m_nWidth ) || ( height > m_nHeight ) )
{
if ( m_pData )
delete[] m_pData;
m_nWidth = width;
m_nHeight = height;
m_nPaddedWidth = ( m_nWidth + 3) >> 2;
m_pData = NULL;
if ( width && height )
m_pData = new FourVectors[ m_nPaddedWidth * m_nHeight ];
}
m_nWidth = width;
m_nHeight = height;
}
CSIMDVectorMatrix( int width, int height )
@@ -86,7 +87,8 @@ public:
{
SetSize( src.m_nWidth, src.m_nHeight );
if ( m_pData )
memcpy( m_pData, src.m_pData, m_nHeight*m_nPaddedWidth*sizeof(m_pData[0]) );
memutils::copy( m_pData, src.m_pData, m_nHeight*m_nPaddedWidth );
return *this;
}
@@ -131,7 +133,9 @@ public:
void Clear( void )
{
Assert( m_pData );
memset( m_pData, 0, m_nHeight*m_nPaddedWidth*sizeof(m_pData[0]) );
static FourVectors value{Four_Zeros, Four_Zeros, Four_Zeros};
memutils::set( m_pData, value, m_nHeight*m_nPaddedWidth );
}
void RaiseToPower( float power );

View File

@@ -2613,6 +2613,13 @@ public:
z=src.z;
}
FourVectors( fltx4 x, fltx4 y, fltx4 z )
{
this->x=x;
this->y=y;
this->z=z;
}
FORCEINLINE void operator=( FourVectors const &src )
{
x=src.x;