mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-16 21:53:01 +00:00
arm64 : fix intptr_t size
This commit is contained in:
+15
-15
@@ -225,7 +225,7 @@ public:
|
||||
void WriteByte(int val);
|
||||
void WriteShort(int val);
|
||||
void WriteWord(int val);
|
||||
void WriteLong(long val);
|
||||
void WriteLong(int32 val);
|
||||
void WriteLongLong(int64 val);
|
||||
void WriteFloat(float val);
|
||||
bool WriteBytes( const void *pBuf, int nBytes );
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
|
||||
public:
|
||||
// The current buffer.
|
||||
unsigned long* RESTRICT m_pData;
|
||||
uint32* RESTRICT m_pData;
|
||||
int m_nDataBytes;
|
||||
int m_nDataBits;
|
||||
|
||||
@@ -342,7 +342,7 @@ BITBUF_INLINE void bf_write::WriteOneBitNoCheck(int nValue)
|
||||
else
|
||||
m_pData[m_iCurBit >> 5] &= ~(1u << (m_iCurBit & 31));
|
||||
#else
|
||||
extern unsigned long g_LittleBits[32];
|
||||
extern uint32 g_LittleBits[32];
|
||||
if(nValue)
|
||||
m_pData[m_iCurBit >> 5] |= g_LittleBits[m_iCurBit & 31];
|
||||
else
|
||||
@@ -379,7 +379,7 @@ inline void bf_write::WriteOneBitAt( int iBit, int nValue )
|
||||
else
|
||||
m_pData[iBit >> 5] &= ~(1u << (iBit & 31));
|
||||
#else
|
||||
extern unsigned long g_LittleBits[32];
|
||||
extern uint32 g_LittleBits[32];
|
||||
if(nValue)
|
||||
m_pData[iBit >> 5] |= g_LittleBits[iBit & 31];
|
||||
else
|
||||
@@ -393,7 +393,7 @@ BITBUF_INLINE void bf_write::WriteUBitLong( unsigned int curData, int numbits, b
|
||||
// Make sure it doesn't overflow.
|
||||
if ( bCheckRange && numbits < 32 )
|
||||
{
|
||||
if ( curData >= (unsigned long)(1 << numbits) )
|
||||
if ( curData >= (uint32)(1 << numbits) )
|
||||
{
|
||||
CallErrorHandler( BITBUFERROR_VALUE_OUT_OF_RANGE, GetDebugName() );
|
||||
}
|
||||
@@ -414,8 +414,8 @@ BITBUF_INLINE void bf_write::WriteUBitLong( unsigned int curData, int numbits, b
|
||||
m_iCurBit += numbits;
|
||||
|
||||
// Mask in a dword.
|
||||
Assert( (iDWord*4 + sizeof(long)) <= (unsigned int)m_nDataBytes );
|
||||
unsigned long * RESTRICT pOut = &m_pData[iDWord];
|
||||
Assert( (iDWord*4 + sizeof(int32)) <= (unsigned int)m_nDataBytes );
|
||||
uint32 * RESTRICT pOut = &m_pData[iDWord];
|
||||
|
||||
// Rotate data into dword alignment
|
||||
curData = (curData << iCurBitMasked) | (curData >> (32 - iCurBitMasked));
|
||||
@@ -427,8 +427,8 @@ BITBUF_INLINE void bf_write::WriteUBitLong( unsigned int curData, int numbits, b
|
||||
|
||||
// Only look beyond current word if necessary (avoid access violation)
|
||||
int i = mask2 & 1;
|
||||
unsigned long dword1 = LoadLittleDWord( pOut, 0 );
|
||||
unsigned long dword2 = LoadLittleDWord( pOut, i );
|
||||
uint32 dword1 = LoadLittleDWord( pOut, 0 );
|
||||
uint32 dword2 = LoadLittleDWord( pOut, i );
|
||||
|
||||
// Drop bits into place
|
||||
dword1 ^= ( mask1 & ( curData ^ dword1 ) );
|
||||
@@ -467,7 +467,7 @@ BITBUF_INLINE void bf_write::WriteBitFloat(float val)
|
||||
{
|
||||
int32 intVal;
|
||||
|
||||
Assert(sizeof(long) == sizeof(float));
|
||||
Assert(sizeof(int32) == sizeof(float));
|
||||
Assert(sizeof(float) == 4);
|
||||
|
||||
Q_memcpy( &intVal, &val, sizeof(intVal));
|
||||
@@ -603,7 +603,7 @@ public:
|
||||
BITBUF_INLINE int ReadByte() { return ReadUBitLong(8); }
|
||||
BITBUF_INLINE int ReadShort() { return (short)ReadUBitLong(16); }
|
||||
BITBUF_INLINE int ReadWord() { return ReadUBitLong(16); }
|
||||
BITBUF_INLINE long ReadLong() { return ReadUBitLong(32); }
|
||||
BITBUF_INLINE int32 ReadLong() { return ReadUBitLong(32); }
|
||||
int64 ReadLongLong();
|
||||
float ReadFloat();
|
||||
bool ReadBytes(void *pOut, int nBytes);
|
||||
@@ -728,7 +728,7 @@ inline bool bf_read::CheckForOverflow(int nBits)
|
||||
inline int bf_read::ReadOneBitNoCheck()
|
||||
{
|
||||
#if VALVE_LITTLE_ENDIAN
|
||||
unsigned int value = ((unsigned long * RESTRICT)m_pData)[m_iCurBit >> 5] >> (m_iCurBit & 31);
|
||||
unsigned int value = ((uint32 * RESTRICT)m_pData)[m_iCurBit >> 5] >> (m_iCurBit & 31);
|
||||
#else
|
||||
unsigned char value = m_pData[m_iCurBit >> 3] >> (m_iCurBit & 7);
|
||||
#endif
|
||||
@@ -787,12 +787,12 @@ BITBUF_INLINE unsigned int bf_read::ReadUBitLong( int numbits ) RESTRICT
|
||||
#if __i386__
|
||||
unsigned int bitmask = (2 << (numbits-1)) - 1;
|
||||
#else
|
||||
extern unsigned long g_ExtraMasks[33];
|
||||
extern uint32 g_ExtraMasks[33];
|
||||
unsigned int bitmask = g_ExtraMasks[numbits];
|
||||
#endif
|
||||
|
||||
unsigned int dw1 = LoadLittleDWord( (unsigned long* RESTRICT)m_pData, iWordOffset1 ) >> iStartBit;
|
||||
unsigned int dw2 = LoadLittleDWord( (unsigned long* RESTRICT)m_pData, iWordOffset2 ) << (32 - iStartBit);
|
||||
unsigned int dw1 = LoadLittleDWord( (uint32* RESTRICT)m_pData, iWordOffset1 ) >> iStartBit;
|
||||
unsigned int dw2 = LoadLittleDWord( (uint32* RESTRICT)m_pData, iWordOffset2 ) << (32 - iStartBit);
|
||||
|
||||
return (dw1 | dw2) & bitmask;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user