Fix CUtlLeanVectorFixedGrowableBase elements alignment (#233)

And update CUtlLeanVectorBase, SchemaClassFlags1_t and NetChanStat_t
This commit is contained in:
vanz696 2024-04-26 22:37:59 +03:00 committed by GitHub
parent e5feddeae9
commit ce8f799264
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 130 additions and 104 deletions

View File

@ -22,7 +22,14 @@
#define MAX_FLOWS 2 // in & out #define MAX_FLOWS 2 // in & out
struct SNetChannelLatencyStats; struct SNetChannelLatencyStats;
struct NetChanStat_t;
struct NetChanStat_t
{
float m_flAvg;
float m_flMin;
float m_flMax;
float m_flStdDev;
};
class INetChannelInfo class INetChannelInfo
{ {

View File

@ -38,7 +38,7 @@ enum SchemaClassFlags1_t
SCHEMA_CF1_INFO_TAG_MClassHasEntityLimitedDataDesc = (1 << 14), SCHEMA_CF1_INFO_TAG_MClassHasEntityLimitedDataDesc = (1 << 14),
SCHEMA_CF1_INFO_TAG_MClassHasCustomAlignedNewDelete = (1 << 15), SCHEMA_CF1_INFO_TAG_MClassHasCustomAlignedNewDelete = (1 << 15),
SCHEMA_CF1_UNK016 = (1 << 16), SCHEMA_CF1_UNK016 = (1 << 16),
SCHEMA_CF1_UNK017 = (1 << 17), SCHEMA_CF1_INFO_TAG_MConstructibleClassBase = (1 << 17),
SCHEMA_CF1_INFO_TAG_MHasKV3TransferPolymorphicClassname = (1 << 18), SCHEMA_CF1_INFO_TAG_MHasKV3TransferPolymorphicClassname = (1 << 18),
}; };

View File

@ -47,17 +47,21 @@ public:
void Purge(); void Purge();
protected: protected:
I m_nSize;
I m_nAllocationCount; struct
T* m_pMemory; {
I m_nCount;
I m_nAllocated;
T* m_pElements;
};
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// constructor, destructor // constructor, destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template< class T, class I > template< class T, class I >
inline CUtlLeanVectorBase<T, I>::CUtlLeanVectorBase() : m_nSize(0), inline CUtlLeanVectorBase<T, I>::CUtlLeanVectorBase() : m_nCount(0),
m_nAllocationCount(0), m_pMemory(0) m_nAllocated(0), m_pElements(NULL)
{ {
} }
@ -73,13 +77,13 @@ inline CUtlLeanVectorBase<T, I>::~CUtlLeanVectorBase()
template< class T, class I > template< class T, class I >
inline T* CUtlLeanVectorBase<T, I>::Base() inline T* CUtlLeanVectorBase<T, I>::Base()
{ {
return m_nAllocationCount ? m_pMemory : NULL; return m_nAllocated ? m_pElements : NULL;
} }
template< class T, class I > template< class T, class I >
inline const T* CUtlLeanVectorBase<T, I>::Base() const inline const T* CUtlLeanVectorBase<T, I>::Base() const
{ {
return m_nAllocationCount ? m_pMemory : NULL; return m_nAllocated ? m_pElements : NULL;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -88,45 +92,45 @@ inline const T* CUtlLeanVectorBase<T, I>::Base() const
template< class T, class I > template< class T, class I >
void CUtlLeanVectorBase<T, I>::EnsureCapacity( int num, bool force ) void CUtlLeanVectorBase<T, I>::EnsureCapacity( int num, bool force )
{ {
I nMinAllocationCount = ( 31 + sizeof( T ) ) / sizeof( T ); I nMinAllocated = ( 31 + sizeof( T ) ) / sizeof( T );
I nMaxAllocationCount = (std::numeric_limits<I>::max)(); I nMaxAllocated = (std::numeric_limits<I>::max)();
I nNewAllocationCount = m_nAllocationCount; I nNewAllocated = m_nAllocated;
if ( force ) if ( force )
{ {
if ( num == m_nAllocationCount ) if ( num == m_nAllocated )
return; return;
} }
else else
{ {
if ( num <= m_nAllocationCount ) if ( num <= m_nAllocated )
return; return;
} }
if ( num > nMaxAllocationCount ) if ( num > nMaxAllocated )
{ {
Msg( "%s allocation count overflow( %llu > %llu )\n", __FUNCTION__, ( uint64 )num, ( uint64 )nMaxAllocationCount ); Msg( "%s allocation count overflow( %llu > %llu )\n", __FUNCTION__, ( uint64 )num, ( uint64 )nMaxAllocated );
Plat_FatalErrorFunc( "%s allocation count overflow", __FUNCTION__ ); Plat_FatalErrorFunc( "%s allocation count overflow", __FUNCTION__ );
DebuggerBreak(); DebuggerBreak();
} }
if ( force ) if ( force )
{ {
nNewAllocationCount = num; nNewAllocated = num;
} }
else else
{ {
while ( nNewAllocationCount < num ) while ( nNewAllocated < num )
{ {
if ( nNewAllocationCount < nMaxAllocationCount/2 ) if ( nNewAllocated < nMaxAllocated/2 )
nNewAllocationCount = MAX( nNewAllocationCount*2, nMinAllocationCount ); nNewAllocated = MAX( nNewAllocated*2, nMinAllocated );
else else
nNewAllocationCount = nMaxAllocationCount; nNewAllocated = nMaxAllocated;
} }
} }
m_pMemory = (T*)realloc( m_pMemory, nNewAllocationCount * sizeof(T) ); m_pElements = (T*)realloc( m_pElements, nNewAllocated * sizeof(T) );
m_nAllocationCount = nNewAllocationCount; m_nAllocated = nNewAllocated;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -136,11 +140,11 @@ template< class T, class I >
void CUtlLeanVectorBase<T, I>::RemoveAll() void CUtlLeanVectorBase<T, I>::RemoveAll()
{ {
T* pElement = Base(); T* pElement = Base();
const T* pEnd = &pElement[ m_nSize ]; const T* pEnd = &pElement[ m_nCount ];
while ( pElement != pEnd ) while ( pElement != pEnd )
Destruct( pElement++ ); Destruct( pElement++ );
m_nSize = 0; m_nCount = 0;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -151,13 +155,13 @@ inline void CUtlLeanVectorBase<T, I>::Purge()
{ {
RemoveAll(); RemoveAll();
if ( m_nAllocationCount > 0 ) if ( m_nAllocated > 0 )
{ {
free( (void*)m_pMemory ); free( (void*)m_pElements );
m_pMemory = 0; m_pElements = NULL;
} }
m_nAllocationCount = 0; m_nAllocated = 0;
} }
template< class T, size_t N, class I > template< class T, size_t N, class I >
@ -182,13 +186,28 @@ public:
void Purge(); void Purge();
protected: protected:
I m_nSize;
I m_nAllocationCount;
union union
{ {
T* m_pMemory; struct
T m_Memory[ N ]; {
I m_nCount;
I m_nAllocated;
};
struct
{
I m_nFixedCount;
I m_nFixedAllocated;
T m_FixedAlloc[ N ];
};
struct
{
I m_nAllocCount;
I m_nAllocAllocated;
T* m_pElements;
};
}; };
}; };
@ -196,8 +215,8 @@ protected:
// constructor, destructor // constructor, destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template< class T, size_t N, class I > template< class T, size_t N, class I >
inline CUtlLeanVectorFixedGrowableBase<T, N, I>::CUtlLeanVectorFixedGrowableBase() : m_nSize(0), inline CUtlLeanVectorFixedGrowableBase<T, N, I>::CUtlLeanVectorFixedGrowableBase() : m_nCount(0),
m_nAllocationCount(N) m_nAllocated(N)
{ {
} }
@ -213,12 +232,12 @@ inline CUtlLeanVectorFixedGrowableBase<T, N, I>::~CUtlLeanVectorFixedGrowableBas
template< class T, size_t N, class I > template< class T, size_t N, class I >
inline T* CUtlLeanVectorFixedGrowableBase<T, N, I>::Base() inline T* CUtlLeanVectorFixedGrowableBase<T, N, I>::Base()
{ {
if ( m_nAllocationCount ) if ( m_nAllocated )
{ {
if ( ( size_t )m_nAllocationCount > N ) if ( ( size_t )m_nAllocated > N )
return m_pMemory; return m_pElements;
else else
return &m_Memory[ 0 ]; return &m_FixedAlloc[ 0 ];
} }
return NULL; return NULL;
@ -227,12 +246,12 @@ inline T* CUtlLeanVectorFixedGrowableBase<T, N, I>::Base()
template< class T, size_t N, class I > template< class T, size_t N, class I >
inline const T* CUtlLeanVectorFixedGrowableBase<T, N, I>::Base() const inline const T* CUtlLeanVectorFixedGrowableBase<T, N, I>::Base() const
{ {
if ( m_nAllocationCount ) if ( m_nAllocated )
{ {
if ( ( size_t )m_nAllocationCount > N ) if ( ( size_t )m_nAllocated > N )
return m_pMemory; return m_pElements;
else else
return &m_Memory[ 0 ]; return &m_FixedAlloc[ 0 ];
} }
return NULL; return NULL;
@ -244,54 +263,54 @@ inline const T* CUtlLeanVectorFixedGrowableBase<T, N, I>::Base() const
template< class T, size_t N, class I > template< class T, size_t N, class I >
void CUtlLeanVectorFixedGrowableBase<T, N, I>::EnsureCapacity( int num, bool force ) void CUtlLeanVectorFixedGrowableBase<T, N, I>::EnsureCapacity( int num, bool force )
{ {
I nMinAllocationCount = ( 31 + sizeof( T ) ) / sizeof( T ); I nMinAllocated = ( 31 + sizeof( T ) ) / sizeof( T );
I nMaxAllocationCount = (std::numeric_limits<I>::max)(); I nMaxAllocated = (std::numeric_limits<I>::max)();
I nNewAllocationCount = m_nAllocationCount; I nNewAllocated = m_nAllocated;
if ( num <= m_nAllocationCount ) if ( num <= m_nAllocated )
return; return;
if ( ( size_t )num > N ) if ( ( size_t )num > N )
{ {
if ( num > nMaxAllocationCount ) if ( num > nMaxAllocated )
{ {
Msg( "%s allocation count overflow( %llu > %llu )\n", __FUNCTION__, ( uint64 )num, ( uint64 )nMaxAllocationCount ); Msg( "%s allocation count overflow( %llu > %llu )\n", __FUNCTION__, ( uint64 )num, ( uint64 )nMaxAllocated );
Plat_FatalErrorFunc( "%s allocation count overflow", __FUNCTION__ ); Plat_FatalErrorFunc( "%s allocation count overflow", __FUNCTION__ );
DebuggerBreak(); DebuggerBreak();
} }
if ( force ) if ( force )
{ {
nNewAllocationCount = num; nNewAllocated = num;
} }
else else
{ {
while ( nNewAllocationCount < num ) while ( nNewAllocated < num )
{ {
if ( nNewAllocationCount < nMaxAllocationCount/2 ) if ( nNewAllocated < nMaxAllocated/2 )
nNewAllocationCount = MAX( nNewAllocationCount*2, nMinAllocationCount ); nNewAllocated = MAX( nNewAllocated*2, nMinAllocated );
else else
nNewAllocationCount = nMaxAllocationCount; nNewAllocated = nMaxAllocated;
} }
} }
} }
else else
{ {
nNewAllocationCount = num; nNewAllocated = num;
} }
if ( ( size_t )m_nAllocationCount > N ) if ( ( size_t )m_nAllocated > N )
{ {
m_pMemory = (T*)realloc( m_pMemory, nNewAllocationCount * sizeof(T) ); m_pElements = (T*)realloc( m_pElements, nNewAllocated * sizeof(T) );
} }
else if ( ( size_t )nNewAllocationCount > N ) else if ( ( size_t )nNewAllocated > N )
{ {
T* pNew = (T*)malloc( nNewAllocationCount * sizeof(T) ); T* pNew = (T*)malloc( nNewAllocated * sizeof(T) );
memcpy( pNew, Base(), m_nSize * sizeof(T) ); memcpy( pNew, Base(), m_nCount * sizeof(T) );
m_pMemory = pNew; m_pElements = pNew;
} }
m_nAllocationCount = nNewAllocationCount; m_nAllocated = nNewAllocated;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -301,11 +320,11 @@ template< class T, size_t N, class I >
void CUtlLeanVectorFixedGrowableBase<T, N, I>::RemoveAll() void CUtlLeanVectorFixedGrowableBase<T, N, I>::RemoveAll()
{ {
T* pElement = Base(); T* pElement = Base();
const T* pEnd = &pElement[ m_nSize ]; const T* pEnd = &pElement[ m_nCount ];
while ( pElement != pEnd ) while ( pElement != pEnd )
Destruct( pElement++ ); Destruct( pElement++ );
m_nSize = 0; m_nCount = 0;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -316,10 +335,10 @@ inline void CUtlLeanVectorFixedGrowableBase<T, N, I>::Purge()
{ {
RemoveAll(); RemoveAll();
if ( ( size_t )m_nAllocationCount > N ) if ( ( size_t )m_nAllocated > N )
free( (void*)m_pMemory ); free( (void*)m_pElements );
m_nAllocationCount = N; m_nAllocated = N;
} }
template< class B, class T, class I > template< class B, class T, class I >
@ -342,7 +361,7 @@ public:
bool operator==( const Iterator_t it ) const { return elem == it.elem && end == it.end; } bool operator==( const Iterator_t it ) const { return elem == it.elem && end == it.end; }
bool operator!=( const Iterator_t it ) const { return elem != it.elem || end != it.end; } bool operator!=( const Iterator_t it ) const { return elem != it.elem || end != it.end; }
}; };
Iterator_t First() const { const T* base = this->Base(); return Iterator_t( base, &base[ this->m_nSize ] ); } Iterator_t First() const { const T* base = this->Base(); return Iterator_t( base, &base[ this->m_nCount ] ); }
Iterator_t Next( const Iterator_t &it ) const { return Iterator_t( it.elem + 1, it.end ); } Iterator_t Next( const Iterator_t &it ) const { return Iterator_t( it.elem + 1, it.end ); }
bool IsValidIterator( const Iterator_t &it ) const { return it.elem != it.end; } bool IsValidIterator( const Iterator_t &it ) const { return it.elem != it.end; }
T& operator[]( const Iterator_t &it ) { return *const_cast<T*>(it.elem); } T& operator[]( const Iterator_t &it ) { return *const_cast<T*>(it.elem); }
@ -424,57 +443,57 @@ inline CUtlLeanVectorImpl<B, T, I>& CUtlLeanVectorImpl<B, T, I>::operator=( cons
template< class B, class T, class I > template< class B, class T, class I >
inline T& CUtlLeanVectorImpl<B, T, I>::operator[]( int i ) inline T& CUtlLeanVectorImpl<B, T, I>::operator[]( int i )
{ {
Assert( i < this->m_nSize ); Assert( i < this->m_nCount );
return this->Base()[ i ]; return this->Base()[ i ];
} }
template< class B, class T, class I > template< class B, class T, class I >
inline const T& CUtlLeanVectorImpl<B, T, I>::operator[]( int i ) const inline const T& CUtlLeanVectorImpl<B, T, I>::operator[]( int i ) const
{ {
Assert( i < this->m_nSize ); Assert( i < this->m_nCount );
return this->Base()[ i ]; return this->Base()[ i ];
} }
template< class B, class T, class I > template< class B, class T, class I >
inline T& CUtlLeanVectorImpl<B, T, I>::Element( int i ) inline T& CUtlLeanVectorImpl<B, T, I>::Element( int i )
{ {
Assert( i < this->m_nSize ); Assert( i < this->m_nCount );
return this->Base()[ i ]; return this->Base()[ i ];
} }
template< class B, class T, class I > template< class B, class T, class I >
inline const T& CUtlLeanVectorImpl<B, T, I>::Element( int i ) const inline const T& CUtlLeanVectorImpl<B, T, I>::Element( int i ) const
{ {
Assert( i < this->m_nSize ); Assert( i < this->m_nCount );
return this->Base()[ i ]; return this->Base()[ i ];
} }
template< class B, class T, class I > template< class B, class T, class I >
inline T& CUtlLeanVectorImpl<B, T, I>::Head() inline T& CUtlLeanVectorImpl<B, T, I>::Head()
{ {
Assert( this->m_nSize > 0 ); Assert( this->m_nCount > 0 );
return this->Base()[ 0 ]; return this->Base()[ 0 ];
} }
template< class B, class T, class I > template< class B, class T, class I >
inline const T& CUtlLeanVectorImpl<B, T, I>::Head() const inline const T& CUtlLeanVectorImpl<B, T, I>::Head() const
{ {
Assert( this->m_nSize > 0 ); Assert( this->m_nCount > 0 );
return this->Base()[ 0 ]; return this->Base()[ 0 ];
} }
template< class B, class T, class I > template< class B, class T, class I >
inline T& CUtlLeanVectorImpl<B, T, I>::Tail() inline T& CUtlLeanVectorImpl<B, T, I>::Tail()
{ {
Assert( this->m_nSize > 0 ); Assert( this->m_nCount > 0 );
return this->Base()[ this->m_nSize - 1 ]; return this->Base()[ this->m_nCount - 1 ];
} }
template< class B, class T, class I > template< class B, class T, class I >
inline const T& CUtlLeanVectorImpl<B, T, I>::Tail() const inline const T& CUtlLeanVectorImpl<B, T, I>::Tail() const
{ {
Assert( this->m_nSize > 0 ); Assert( this->m_nCount > 0 );
return this->Base()[ this->m_nSize - 1 ]; return this->Base()[ this->m_nCount - 1 ];
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -483,7 +502,7 @@ inline const T& CUtlLeanVectorImpl<B, T, I>::Tail() const
template< class B, class T, class I > template< class B, class T, class I >
inline int CUtlLeanVectorImpl<B, T, I>::Count() const inline int CUtlLeanVectorImpl<B, T, I>::Count() const
{ {
return this->m_nSize; return this->m_nCount;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -492,7 +511,7 @@ inline int CUtlLeanVectorImpl<B, T, I>::Count() const
template< class B, class T, class I > template< class B, class T, class I >
inline bool CUtlLeanVectorImpl<B, T, I>::IsValidIndex( int i ) const inline bool CUtlLeanVectorImpl<B, T, I>::IsValidIndex( int i ) const
{ {
return (i >= 0) && (i < this->m_nSize); return (i >= 0) && (i < this->m_nCount);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -510,10 +529,10 @@ inline int CUtlLeanVectorImpl<B, T, I>::InvalidIndex()
template< class B, class T, class I > template< class B, class T, class I >
T* CUtlLeanVectorImpl<B, T, I>::AddToTailGetPtr() T* CUtlLeanVectorImpl<B, T, I>::AddToTailGetPtr()
{ {
this->EnsureCapacity( this->m_nSize + 1 ); this->EnsureCapacity( this->m_nCount + 1 );
T* pBase = this->Base(); T* pBase = this->Base();
Construct( &pBase[ this->m_nSize ] ); Construct( &pBase[ this->m_nCount ] );
return &pBase[ this->m_nSize++ ]; return &pBase[ this->m_nCount++ ];
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -522,10 +541,10 @@ T* CUtlLeanVectorImpl<B, T, I>::AddToTailGetPtr()
template< class B, class T, class I > template< class B, class T, class I >
int CUtlLeanVectorImpl<B, T, I>::AddToTail( const T& src ) int CUtlLeanVectorImpl<B, T, I>::AddToTail( const T& src )
{ {
this->EnsureCapacity( this->m_nSize + 1 ); this->EnsureCapacity( this->m_nCount + 1 );
T* pBase = this->Base(); T* pBase = this->Base();
CopyConstruct( &pBase[ this->m_nSize ], src ); CopyConstruct( &pBase[ this->m_nCount ], src );
return this->m_nSize++; return this->m_nCount++;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -534,7 +553,7 @@ int CUtlLeanVectorImpl<B, T, I>::AddToTail( const T& src )
template< class B, class T, class I > template< class B, class T, class I >
int CUtlLeanVectorImpl<B, T, I>::AddMultipleToTail( int nSize ) int CUtlLeanVectorImpl<B, T, I>::AddMultipleToTail( int nSize )
{ {
int nOldSize = this->m_nSize; int nOldSize = this->m_nCount;
if ( nSize > 0 ) if ( nSize > 0 )
{ {
@ -555,7 +574,7 @@ int CUtlLeanVectorImpl<B, T, I>::AddMultipleToTail( int nSize )
ConstructElements( &pBase[ nOldSize ], &pBase[ nNewSize ] ); ConstructElements( &pBase[ nOldSize ], &pBase[ nNewSize ] );
this->m_nSize = nNewSize; this->m_nCount = nNewSize;
} }
return nOldSize; return nOldSize;
@ -567,7 +586,7 @@ int CUtlLeanVectorImpl<B, T, I>::AddMultipleToTail( int nSize )
template< class B, class T, class I > template< class B, class T, class I >
T* CUtlLeanVectorImpl<B, T, I>::InsertBeforeGetPtr( int nBeforeIndex, int nSize ) T* CUtlLeanVectorImpl<B, T, I>::InsertBeforeGetPtr( int nBeforeIndex, int nSize )
{ {
int nOldSize = this->m_nSize; int nOldSize = this->m_nCount;
if ( nBeforeIndex < 0 || nBeforeIndex > nOldSize ) if ( nBeforeIndex < 0 || nBeforeIndex > nOldSize )
{ {
@ -599,7 +618,7 @@ T* CUtlLeanVectorImpl<B, T, I>::InsertBeforeGetPtr( int nBeforeIndex, int nSize
ShiftElements( &pBase[ nBeforeIndex + nSize ], &pBase[ nBeforeIndex ], &pBase[ nOldSize ] ); ShiftElements( &pBase[ nBeforeIndex + nSize ], &pBase[ nBeforeIndex ], &pBase[ nOldSize ] );
ConstructElements( &pBase[ nBeforeIndex ], &pBase[ nBeforeIndex + nSize ] ); ConstructElements( &pBase[ nBeforeIndex ], &pBase[ nBeforeIndex + nSize ] );
this->m_nSize = nNewSize; this->m_nCount = nNewSize;
return &pBase[ nBeforeIndex ]; return &pBase[ nBeforeIndex ];
} }
@ -611,12 +630,12 @@ void CUtlLeanVectorImpl<B, T, I>::SetCount( int count )
T* pBase = this->Base(); T* pBase = this->Base();
if ( this->m_nSize < count ) if ( this->m_nCount < count )
ConstructElements( &pBase[ this->m_nSize ], &pBase[ count ] ); ConstructElements( &pBase[ this->m_nCount ], &pBase[ count ] );
else if ( this->m_nSize > count ) else if ( this->m_nCount > count )
DestructElements( &pBase[ count ], &pBase[ this->m_nSize ] ); DestructElements( &pBase[ count ], &pBase[ this->m_nCount ] );
this->m_nSize = count; this->m_nCount = count;
} }
template< class B, class T, class I > template< class B, class T, class I >
@ -650,11 +669,11 @@ void CUtlLeanVectorImpl<B, T, I>::FastRemove( int elem )
T* pBase = this->Base(); T* pBase = this->Base();
Destruct( &pBase[ elem ] ); Destruct( &pBase[ elem ] );
if ( this->m_nSize > 0 ) if ( this->m_nCount > 0 )
{ {
if ( elem != this->m_nSize - 1 ) if ( elem != this->m_nCount - 1 )
memcpy( &pBase[ elem ], &pBase[ this->m_nSize - 1 ], sizeof( T ) ); memcpy( &pBase[ elem ], &pBase[ this->m_nCount - 1 ], sizeof( T ) );
--this->m_nSize; --this->m_nCount;
} }
} }
@ -663,8 +682,8 @@ void CUtlLeanVectorImpl<B, T, I>::Remove( int elem )
{ {
T* pBase = this->Base(); T* pBase = this->Base();
Destruct( &pBase[ elem ] ); Destruct( &pBase[ elem ] );
ShiftElements( &pBase[ elem ], &pBase[ elem + 1 ], &pBase[ this->m_nSize ] ); ShiftElements( &pBase[ elem ], &pBase[ elem + 1 ], &pBase[ this->m_nCount ] );
--this->m_nSize; --this->m_nCount;
} }
template< class B, class T, class I > template< class B, class T, class I >
@ -699,8 +718,8 @@ void CUtlLeanVectorImpl<B, T, I>::RemoveMultiple( int elem, int num )
T* pBase = this->Base(); T* pBase = this->Base();
DestructElements( &pBase[ elem ], &pBase[ elem + num ] ); DestructElements( &pBase[ elem ], &pBase[ elem + num ] );
ShiftElements( &pBase[ elem ], &pBase[ elem + num ], &pBase[ this->m_nSize ] ); ShiftElements( &pBase[ elem ], &pBase[ elem + num ], &pBase[ this->m_nCount ] );
this->m_nSize -= num; this->m_nCount -= num;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------