Fix clang compile

This commit is contained in:
JusicP
2021-04-28 18:24:16 +03:00
parent c70e496e72
commit d349b1769a
15 changed files with 65 additions and 47 deletions

View File

@@ -4243,6 +4243,13 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags)
{
#ifdef _WIN32
SetFileTime(h,&ze.ctime,&ze.atime,&ze.mtime);
#elif defined( ANDROID )
struct timespec ts[2];
ts[0].tv_sec = ze.atime;
ts[0].tv_nsec = 0;
ts[1].tv_sec = ze.mtime;
ts[1].tv_nsec = 0;
utimensat((int)h, NULL, ts, 0);
#else
struct timeval tv[2];
tv[0].tv_sec = ze.atime;

View File

@@ -1244,11 +1244,11 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX7_t &vertex )
const char *pRead = (char *)&vertex;
char *pCurrPos = (char *)m_pCurrPosition;
__m128 m1 = _mm_load_ps( (float *)pRead );
__m128 m2 = _mm_load_ps( (float *)(pRead + 16) );
__m128 m3 = _mm_load_ps( (float *)(pRead + 32) );
__m128 m2 = _mm_load_ps( (float *)((int)pRead + 16) );
__m128 m3 = _mm_load_ps( (float *)((int)pRead + 32) );
_mm_stream_ps( (float *)pCurrPos, m1 );
_mm_stream_ps( (float *)(pCurrPos + 16), m2 );
_mm_stream_ps( (float *)(pCurrPos + 32), m3 );
_mm_stream_ps( (float *)((int)pCurrPos + 16), m2 );
_mm_stream_ps( (float *)((int)pCurrPos + 32), m3 );
#else
Error( "Implement CMeshBuilder::FastVertexSSE(dx7)" );
#endif
@@ -1436,13 +1436,13 @@ inline void CVertexBuilder::FastVertexSSE( const ModelVertexDX8_t &vertex )
:: "r" (pRead), "r" (pCurrPos) : "memory"); */
__m128 m1 = _mm_load_ps( (float *)pRead );
__m128 m2 = _mm_load_ps( (float *)(pRead + 16) );
__m128 m3 = _mm_load_ps( (float *)(pRead + 32) );
__m128 m4 = _mm_load_ps( (float *)(pRead + 48) );
__m128 m2 = _mm_load_ps( (float *)((int)pRead + 16) );
__m128 m3 = _mm_load_ps( (float *)((int)pRead + 32) );
__m128 m4 = _mm_load_ps( (float *)((int)pRead + 48) );
_mm_stream_ps( (float *)pCurrPos, m1 );
_mm_stream_ps( (float *)(pCurrPos + 16), m2 );
_mm_stream_ps( (float *)(pCurrPos + 32), m3 );
_mm_stream_ps( (float *)(pCurrPos + 48), m4 );
_mm_stream_ps( (float *)((int)pCurrPos + 16), m2 );
_mm_stream_ps( (float *)((int)pCurrPos + 32), m3 );
_mm_stream_ps( (float *)((int)pCurrPos + 48), m4 );
#else
Error( "Implement CMeshBuilder::FastVertexSSE((dx8)" );
#endif

View File

@@ -42,28 +42,28 @@ public:
FORCEINLINE void ActivateByteSwapping( bool bSwap );
#endif
FORCEINLINE void Seek( int x, int y );
FORCEINLINE void* SkipBytes( int n );
FORCEINLINE void Seek( int x, int y ) RESTRICT;
FORCEINLINE void* SkipBytes( int n ) RESTRICT;
FORCEINLINE void SkipPixels( int n );
FORCEINLINE void WritePixel( int r, int g, int b, int a = 255 );
FORCEINLINE void WritePixelNoAdvance( int r, int g, int b, int a = 255 );
FORCEINLINE void WritePixelNoAdvance( int r, int g, int b, int a = 255 ) RESTRICT;
FORCEINLINE void WritePixelSigned( int r, int g, int b, int a = 255 );
FORCEINLINE void WritePixelNoAdvanceSigned( int r, int g, int b, int a = 255 );
FORCEINLINE void ReadPixelNoAdvance( int &r, int &g, int &b, int &a );
// Floating point formats
FORCEINLINE void WritePixelNoAdvanceF( float r, float g, float b, float a = 1.0f );
FORCEINLINE void WritePixelNoAdvanceF( float r, float g, float b, float a = 1.0f ) RESTRICT;
FORCEINLINE void WritePixelF( float r, float g, float b, float a = 1.0f );
// SIMD formats
FORCEINLINE void WritePixel( FLTX4 rgba );
FORCEINLINE void WritePixel( FLTX4 rgba ) RESTRICT;
FORCEINLINE void WritePixelNoAdvance( FLTX4 rgba );
#ifdef _X360
// here are some explicit formats so we can avoid the switch:
FORCEINLINE void WritePixelNoAdvance_RGBA8888( FLTX4 rgba );
FORCEINLINE void WritePixelNoAdvance_BGRA8888( FLTX4 rgba );
// as above, but with m_pBits passed in to avoid a LHS
FORCEINLINE void WritePixelNoAdvance_BGRA8888( FLTX4 rgba, void *pBits );
FORCEINLINE void WritePixelNoAdvance_BGRA8888( FLTX4 rgba, void *pBits ) RESTRICT;
// for writing entire SIMD registers at once when they have
// already been packed, and when m_pBits is vector-aligned
// (which is a requirement for write-combined memory)
@@ -73,9 +73,9 @@ public:
#endif
FORCEINLINE unsigned char GetPixelSize() { return m_Size; }
FORCEINLINE unsigned char GetPixelSize() RESTRICT { return m_Size; }
FORCEINLINE bool IsUsingFloatFormat() const;
FORCEINLINE bool IsUsingFloatFormat() RESTRICT const;
FORCEINLINE unsigned char *GetCurrentPixel() { return m_pBits; }
private:
@@ -108,7 +108,7 @@ private:
#endif
};
FORCEINLINE_PIXEL bool CPixelWriter::IsUsingFloatFormat() const
FORCEINLINE_PIXEL bool CPixelWriter::IsUsingFloatFormat() RESTRICT const
{
return (m_nFlags & PIXELWRITER_USING_FLOAT_FORMAT) != 0;
}
@@ -379,7 +379,7 @@ FORCEINLINE void CPixelWriter::ActivateByteSwapping( bool bSwap )
//-----------------------------------------------------------------------------
// Sets where we're writing to
//-----------------------------------------------------------------------------
FORCEINLINE_PIXEL void CPixelWriter::Seek( int x, int y )
FORCEINLINE_PIXEL void CPixelWriter::Seek( int x, int y ) RESTRICT
{
m_pBits = m_pBase + y * m_BytesPerRow + x * m_Size;
}
@@ -407,7 +407,7 @@ FORCEINLINE_PIXEL void CPixelWriter::SkipPixels( int n )
//-----------------------------------------------------------------------------
// Writes a pixel without advancing the index PC ONLY
//-----------------------------------------------------------------------------
FORCEINLINE_PIXEL void CPixelWriter::WritePixelNoAdvanceF( float r, float g, float b, float a )
FORCEINLINE_PIXEL void CPixelWriter::WritePixelNoAdvanceF( float r, float g, float b, float a ) RESTRICT
{
Assert( IsUsingFloatFormat() );
@@ -473,7 +473,7 @@ FORCEINLINE_PIXEL void CPixelWriter::WritePixelSigned( int r, int g, int b, int
//-----------------------------------------------------------------------------
// Writes a pixel without advancing the index
//-----------------------------------------------------------------------------
FORCEINLINE_PIXEL void CPixelWriter::WritePixelNoAdvance( int r, int g, int b, int a )
FORCEINLINE_PIXEL void CPixelWriter::WritePixelNoAdvance( int r, int g, int b, int a ) RESTRICT
{
Assert( !IsUsingFloatFormat() );

View File

@@ -2655,8 +2655,8 @@ public:
const void *m_expectedVModel;
// double-check that the data I point to hasn't changed
bool ValidateAgainst( const CStudioHdr * RESTRICT pstudiohdr );
void SetValidationPair( const CStudioHdr *RESTRICT pstudiohdr );
bool ValidateAgainst( const CStudioHdr * RESTRICT pstudiohdr ) RESTRICT;
void SetValidationPair( const CStudioHdr *RESTRICT pstudiohdr ) RESTRICT;
friend class CStudioHdr;
};

View File

@@ -181,7 +181,7 @@ public:
void WriteOneBitAt( int iBit, int nValue );
// Write signed or unsigned. Range is only checked in debug.
void WriteUBitLong( unsigned int data, int numbits, bool bCheckRange=true );
void WriteUBitLong( unsigned int data, int numbits, bool bCheckRange=true ) RESTRICT;
void WriteSBitLong( int data, int numbits );
// Tell it whether or not the data is unsigned. If it's signed,
@@ -241,7 +241,7 @@ public:
int GetNumBytesWritten() const;
int GetNumBitsWritten() const;
int GetMaxNumBits();
int GetNumBitsLeft();
int GetNumBitsLeft() RESTRICT;
int GetNumBytesLeft();
unsigned char* GetData();
const unsigned char* GetData() const;
@@ -250,7 +250,7 @@ public:
bool CheckForOverflow(int nBits);
inline bool IsOverflowed() const {return m_bOverflow;}
void SetOverflowFlag();
void SetOverflowFlag() RESTRICT;
public:
@@ -292,7 +292,7 @@ inline int bf_write::GetMaxNumBits()
return m_nDataBits;
}
inline int bf_write::GetNumBitsLeft()
inline int bf_write::GetNumBitsLeft() RESTRICT
{
return m_nDataBits - m_iCurBit;
}
@@ -323,7 +323,7 @@ BITBUF_INLINE bool bf_write::CheckForOverflow(int nBits)
return m_bOverflow;
}
BITBUF_INLINE void bf_write::SetOverflowFlag()
BITBUF_INLINE void bf_write::SetOverflowFlag() RESTRICT
{
#ifdef DBGFLAG_ASSERT
if ( m_bAssertOnOverflow )
@@ -635,7 +635,7 @@ public:
public:
int GetNumBytesLeft();
int GetNumBytesRead();
int GetNumBitsLeft();
int GetNumBitsLeft() RESTRICT;
int GetNumBitsRead() const;
// Has the buffer overflowed?
@@ -645,7 +645,7 @@ public:
inline bool SeekRelative(int iBitDelta); // Seek to an offset from the current position.
// Called when the buffer is overflowed.
void SetOverflowFlag();
void SetOverflowFlag() RESTRICT;
public:
@@ -678,7 +678,7 @@ inline int bf_read::GetNumBytesRead()
return BitByte(m_iCurBit);
}
inline int bf_read::GetNumBitsLeft()
inline int bf_read::GetNumBitsLeft() RESTRICT
{
return m_nDataBits - m_iCurBit;
}