mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
amd64: fix mempool, utlbuffer align
This commit is contained in:
+4
-4
@@ -317,18 +317,18 @@ void* SendProxy_SendLocalDataTable( const SendProp *pProp, const void *pStruct,
|
||||
// ---------------------------------------------------------------------- //
|
||||
float AssignRangeMultiplier( int nBits, double range )
|
||||
{
|
||||
unsigned long iHighValue;
|
||||
uint32 iHighValue;
|
||||
if ( nBits == 32 )
|
||||
iHighValue = 0xFFFFFFFE;
|
||||
else
|
||||
iHighValue = ((1 << (unsigned long)nBits) - 1);
|
||||
iHighValue = ((1 << (uint32)nBits) - 1);
|
||||
|
||||
float fHighLowMul = iHighValue / range;
|
||||
if ( CloseEnough( range, 0 ) )
|
||||
fHighLowMul = iHighValue;
|
||||
|
||||
// If the precision is messing us up, then adjust it so it won't.
|
||||
if ( (unsigned long)(fHighLowMul * range) > iHighValue ||
|
||||
if ( (uint32)(fHighLowMul * range) > iHighValue ||
|
||||
(fHighLowMul * range) > (double)iHighValue )
|
||||
{
|
||||
// Squeeze it down smaller and smaller until it's going to produce an integer
|
||||
@@ -338,7 +338,7 @@ float AssignRangeMultiplier( int nBits, double range )
|
||||
for ( i=0; i < ARRAYSIZE( multipliers ); i++ )
|
||||
{
|
||||
fHighLowMul = (float)( iHighValue / range ) * multipliers[i];
|
||||
if ( (unsigned long)(fHighLowMul * range) > iHighValue ||
|
||||
if ( (uint32)(fHighLowMul * range) > iHighValue ||
|
||||
(fHighLowMul * range) > (double)iHighValue )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ inline void CClassMemoryPool<T>::Clear()
|
||||
static CUtlMemoryPool s_Allocator
|
||||
|
||||
#define DEFINE_FIXEDSIZE_ALLOCATOR( _class, _initsize, _grow ) \
|
||||
CUtlMemoryPool _class::s_Allocator(sizeof(_class), _initsize, _grow, #_class " pool")
|
||||
CUtlMemoryPool _class::s_Allocator(sizeof(_class), _initsize, _grow, #_class " pool", alignof(_class))
|
||||
|
||||
#define DEFINE_FIXEDSIZE_ALLOCATOR_ALIGNED( _class, _initsize, _grow, _alignment ) \
|
||||
CUtlMemoryPool _class::s_Allocator(sizeof(_class), _initsize, _grow, #_class " pool", _alignment )
|
||||
@@ -447,7 +447,7 @@ inline void CClassMemoryPool<T>::Clear()
|
||||
static CMemoryPoolMT s_Allocator
|
||||
|
||||
#define DEFINE_FIXEDSIZE_ALLOCATOR_MT( _class, _initsize, _grow ) \
|
||||
CMemoryPoolMT _class::s_Allocator(sizeof(_class), _initsize, _grow, #_class " pool")
|
||||
CMemoryPoolMT _class::s_Allocator(sizeof(_class), _initsize, _grow, #_class " pool", alignof(_class))
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Macros that make it simple to make a class use a fixed-size allocator
|
||||
|
||||
@@ -672,7 +672,7 @@ inline void CUtlBuffer::GetObject( T *dest )
|
||||
{
|
||||
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
|
||||
{
|
||||
*dest = *(T *)PeekGet();
|
||||
memcpy( dest, PeekGet(), sizeof( T ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -704,6 +704,7 @@ inline void CUtlBuffer::GetTypeBin( T &dest )
|
||||
{
|
||||
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
|
||||
{
|
||||
memcpy(&dest, PeekGet(), sizeof(T) );
|
||||
dest = *(T *)PeekGet();
|
||||
}
|
||||
else
|
||||
@@ -1050,7 +1051,7 @@ inline void CUtlBuffer::PutObject( T *src )
|
||||
{
|
||||
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
|
||||
{
|
||||
*(T *)PeekPut() = *src;
|
||||
memcpy( PeekPut(), src, sizeof( T ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1079,7 +1080,7 @@ inline void CUtlBuffer::PutTypeBin( T src )
|
||||
{
|
||||
if ( !m_Byteswap.IsSwappingBytes() || ( sizeof( T ) == 1 ) )
|
||||
{
|
||||
*(T *)PeekPut() = src;
|
||||
memcpy( PeekPut(), &src, sizeof( T ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user