Fixed compilation of bitbuf on gcc/clang

This commit is contained in:
Jordan Cristiano 2015-08-31 22:16:29 -04:00
parent efab1c3707
commit 58a17bc97e
2 changed files with 10 additions and 10 deletions

View File

@ -9,7 +9,7 @@
#include "sourcesdk/bitbuf.h" #include "sourcesdk/bitbuf.h"
#include <string.h> #include <string.h>
#include <cmath> #include <cmath>
#include <stdlib.h> #include <cstdlib>
// FIXME: Can't use this until we get multithreaded allocations in tier0 working for tools // FIXME: Can't use this until we get multithreaded allocations in tier0 working for tools
// This is used by VVIS and fails to link // This is used by VVIS and fails to link
@ -1460,7 +1460,7 @@ void bf_read::ExciseBits( int startbit, int bitstoremove )
m_nDataBytes = m_nDataBits >> 3; m_nDataBytes = m_nDataBits >> 3;
} }
int bf_read::CompareBitsAt( int offset, bf_read * __restrict other, int otherOffset, int numbits ) __restrict int bf_read::CompareBitsAt( int offset, bf_read * __restrict other, int otherOffset, int numbits )
{ {
extern unsigned long g_ExtraMasks[33]; extern unsigned long g_ExtraMasks[33];

View File

@ -157,7 +157,7 @@ public:
void WriteOneBitAt( int iBit, int nValue ); void WriteOneBitAt( int iBit, int nValue );
// Write signed or unsigned. Range is only checked in debug. // Write signed or unsigned. Range is only checked in debug.
void WriteUBitLong( unsigned int data, int numbits, bool bCheckRange=true ) __restrict; void WriteUBitLong( unsigned int data, int numbits, bool bCheckRange=true );
void WriteSBitLong( int data, int numbits ); void WriteSBitLong( int data, int numbits );
// Tell it whether or not the data is unsigned. If it's signed, // Tell it whether or not the data is unsigned. If it's signed,
@ -373,7 +373,7 @@ inline void bf_write::WriteOneBitAt( int iBit, int nValue )
#endif #endif
} }
inline void bf_write::WriteUBitLong( unsigned int curData, int numbits, bool bCheckRange ) __restrict inline void bf_write::WriteUBitLong( unsigned int curData, int numbits, bool bCheckRange )
{ {
#ifdef _DEBUG #ifdef _DEBUG
// Make sure it doesn't overflow. // Make sure it doesn't overflow.
@ -556,8 +556,8 @@ public:
float ReadBitAngle( int numbits ); float ReadBitAngle( int numbits );
unsigned int ReadUBitLong( int numbits ) __restrict; unsigned int ReadUBitLong( int numbits );
unsigned int ReadUBitLongNoInline( int numbits ) __restrict; unsigned int ReadUBitLongNoInline( int numbits );
unsigned int PeekUBitLong( int numbits ); unsigned int PeekUBitLong( int numbits );
int ReadSBitLong( int numbits ); int ReadSBitLong( int numbits );
@ -619,8 +619,8 @@ public:
char* ReadAndAllocateString( bool *pOverflow = 0 ); char* ReadAndAllocateString( bool *pOverflow = 0 );
// Returns nonzero if any bits differ // Returns nonzero if any bits differ
int CompareBits( bf_read * __restrict other, int bits ) __restrict; int CompareBits( bf_read * __restrict other, int bits );
int CompareBitsAt( int offset, bf_read * __restrict other, int otherOffset, int bits ) __restrict; int CompareBitsAt( int offset, bf_read * __restrict other, int otherOffset, int bits );
// Status. // Status.
public: public:
@ -770,7 +770,7 @@ inline unsigned int bf_read::ReadUBitVar()
return sixbits >> 2; return sixbits >> 2;
} }
inline unsigned int bf_read::ReadUBitLong( int numbits ) __restrict inline unsigned int bf_read::ReadUBitLong( int numbits )
{ {
Assert( numbits > 0 && numbits <= 32 ); Assert( numbits > 0 && numbits <= 32 );
@ -803,7 +803,7 @@ inline unsigned int bf_read::ReadUBitLong( int numbits ) __restrict
return (dw1 | dw2) & bitmask; return (dw1 | dw2) & bitmask;
} }
inline int bf_read::CompareBits( bf_read * __restrict other, int numbits ) __restrict inline int bf_read::CompareBits( bf_read * __restrict other, int numbits )
{ {
return (ReadUBitLong(numbits) != other->ReadUBitLong(numbits)); return (ReadUBitLong(numbits) != other->ReadUBitLong(numbits));
} }