mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 03:56:10 +08:00
Update AlignedByteArray_t
This commit is contained in:
@ -1786,9 +1786,12 @@ template < size_t NUM, class T > struct AlignedByteArray_t : public AlignedByteA
|
|||||||
struct ALIGN_N( ALIGN ) AlignedByteArrayExplicit_t< NUM, T, ALIGN > \
|
struct ALIGN_N( ALIGN ) AlignedByteArrayExplicit_t< NUM, T, ALIGN > \
|
||||||
{ \
|
{ \
|
||||||
/* NOTE: verify alignment in the constructor (which may be wrong if this is heap-allocated, for ALIGN > MEMALLOC_MAX_AUTO_ALIGN) */ \
|
/* NOTE: verify alignment in the constructor (which may be wrong if this is heap-allocated, for ALIGN > MEMALLOC_MAX_AUTO_ALIGN) */ \
|
||||||
AlignedByteArrayExplicit_t() { if ( (ALIGN-1) & (size_t)this ) { DebuggerBreakIfDebugging(); } } \
|
AlignedByteArrayExplicit_t() { if ( (ALIGN-1) & (size_t)this ) { Plat_NonFatalErrorFunc( "AlignedByteArray not properly aligned\n" ); } } \
|
||||||
T * Base( void ) { ValidateAlignmentExplicit<T,ALIGN>(); return (T *)&m_Data; } \
|
T * Base( void ) { ValidateAlignmentExplicit<T,ALIGN>(); return (T *)&m_Data; } \
|
||||||
const T * Base( void ) const { ValidateAlignmentExplicit<T,ALIGN>(); return (const T *)&m_Data; } \
|
const T * Base( void ) const { ValidateAlignmentExplicit<T,ALIGN>(); return (const T *)&m_Data; } \
|
||||||
|
size_t Count() const { return NUM; } \
|
||||||
|
T &operator[]( int i ) { return Base()[i]; } \
|
||||||
|
const T &operator[]( int i ) const { return Base()[i]; } \
|
||||||
private: \
|
private: \
|
||||||
byte m_Data[ NUM*sizeof( T ) ]; \
|
byte m_Data[ NUM*sizeof( T ) ]; \
|
||||||
} ALIGN_N_POST( ALIGN );
|
} ALIGN_N_POST( ALIGN );
|
||||||
|
Reference in New Issue
Block a user