Trivial pointer cast fixes for x86_64

This commit is contained in:
dhewg 2011-12-01 14:17:32 +01:00
parent 2995bcab30
commit 6b1e27b157
13 changed files with 23 additions and 20 deletions

View file

@ -167,7 +167,7 @@ void idAASLocal::CalculateAreaTravelTimes(void) {
}
}
assert( ( (unsigned int) bytePtr - (unsigned int) areaTravelTimes ) <= numAreaTravelTimes * sizeof( unsigned short ) );
assert( ( ( ptrdiff_t ) bytePtr - ( ptrdiff_t ) areaTravelTimes ) <= numAreaTravelTimes * sizeof( unsigned short ) );
}
/*

View file

@ -167,7 +167,7 @@ void idAASLocal::CalculateAreaTravelTimes(void) {
}
}
assert( ( (unsigned int) bytePtr - (unsigned int) areaTravelTimes ) <= numAreaTravelTimes * sizeof( unsigned short ) );
assert( ( (ptrdiff_t) bytePtr - (ptrdiff_t) areaTravelTimes ) <= numAreaTravelTimes * sizeof( unsigned short ) );
}
/*

View file

@ -2936,7 +2936,7 @@ const char *idMat6::ToString( int precision ) const {
//===============================================================
float idMatX::temp[MATX_MAX_TEMP+4];
float * idMatX::tempPtr = (float *) ( ( (int) idMatX::temp + 15 ) & ~15 );
float * idMatX::tempPtr = (float *) ( ( (intptr_t) idMatX::temp + 15 ) & ~15 );
int idMatX::tempIndex = 0;

View file

@ -2280,7 +2280,7 @@ ID_INLINE void idMatX::SetData( int rows, int columns, float *data ) {
if ( mat != NULL && alloced != -1 ) {
Mem_Free16( mat );
}
assert( ( ( (int) data ) & 15 ) == 0 ); // data must be 16 byte aligned
assert( ( ( (uintptr_t) data ) & 15 ) == 0 ); // data must be 16 byte aligned
mat = data;
alloced = -1;
numRows = rows;

View file

@ -384,7 +384,7 @@ const char *idVec6::ToString( int precision ) const {
//===============================================================
float idVecX::temp[VECX_MAX_TEMP+4];
float * idVecX::tempPtr = (float *) ( ( (int) idVecX::temp + 15 ) & ~15 );
float * idVecX::tempPtr = (float *) ( ( (intptr_t) idVecX::temp + 15 ) & ~15 );
int idVecX::tempIndex = 0;
/*

View file

@ -1757,7 +1757,7 @@ ID_INLINE void idVecX::SetData( int length, float *data ) {
if ( p && ( p < idVecX::tempPtr || p >= idVecX::tempPtr + VECX_MAX_TEMP ) && alloced != -1 ) {
Mem_Free16( p );
}
assert( ( ( (int) data ) & 15 ) == 0 ); // data must be 16 byte aligned
assert( ( ( (uintptr_t) data ) & 15 ) == 0 ); // data must be 16 byte aligned
p = data;
size = length;
alloced = -1;

View file

@ -1240,8 +1240,8 @@ void idCinematicLocal::readQuadInfo( byte *qData ) {
half = false;
smootheddouble = false;
t[0] = (0 - (unsigned int)image)+(unsigned int)image+screenDelta;
t[1] = (0 - ((unsigned int)image + screenDelta))+(unsigned int)image;
t[0] = (0 - (ptrdiff_t)image)+(ptrdiff_t)image+screenDelta;
t[1] = (0 - ((ptrdiff_t)image + screenDelta))+(ptrdiff_t)image;
drawX = CIN_WIDTH;
drawY = CIN_HEIGHT;

View file

@ -2131,7 +2131,8 @@ int lwGetPolygons5( idFile *fp, int cksize, lwPolygonList *plist, int ptoffset )
lwPolygon *pp;
lwPolVert *pv;
unsigned char *buf, *bp;
int i, j, nv, nverts, npols;
int i, nv, nverts, npols;
ptrdiff_t j;
if ( cksize == 0 ) return 1;
@ -2678,7 +2679,8 @@ int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist,
lwSurface **surf, int *nsurfs )
{
lwSurface **s, *st;
int i, index;
int i;
ptrdiff_t index;
if ( tlist->count == 0 ) return 1;
@ -2697,7 +2699,7 @@ int lwResolvePolySurfaces( lwPolygonList *polygon, lwTagList *tlist,
}
for ( i = 0; i < polygon->count; i++ ) {
index = ( int ) polygon->pol[ i ].surf;
index = ( ptrdiff_t ) polygon->pol[ i ].surf;
if ( index < 0 || index > tlist->count ) return 0;
if ( !s[ index ] ) {
s[ index ] = lwDefaultSurface();
@ -2858,7 +2860,8 @@ Read polygon tags from a PTAG chunk in an LWO2 file.
int lwGetPolygonTags( idFile *fp, int cksize, lwTagList *tlist, lwPolygonList *plist )
{
unsigned int type;
int rlen = 0, i, j;
int rlen = 0, i;
ptrdiff_t j;
set_flen( 0 );
type = getU4( fp );

View file

@ -321,7 +321,7 @@ void idSoundSystemLocal::Init() {
}
// make a 16 byte aligned finalMixBuffer
finalMixBuffer = (float *) ( ( ( (int)realAccum ) + 15 ) & ~15 );
finalMixBuffer = (float *) ( ( ( (intptr_t)realAccum ) + 15 ) & ~15 );
graph = NULL;

View file

@ -588,7 +588,7 @@ void idSoundWorldLocal::AVIUpdate() {
}
float mix[MIXBUFFER_SAMPLES*6+16];
float *mix_p = (float *)((( int)mix + 15 ) & ~15); // SIMD align
float *mix_p = (float *)((( intptr_t)mix + 15 ) & ~15); // SIMD align
SIMDProcessor->Memset( mix_p, 0, MIXBUFFER_SAMPLES*sizeof(float)*numSpeakers );
@ -1713,7 +1713,7 @@ void idSoundWorldLocal::AddChannelContribution( idSoundEmitterLocal *sound, idSo
//
int offset = current44kHz - chan->trigger44kHzTime;
float inputSamples[MIXBUFFER_SAMPLES*2+16];
float *alignedInputSamples = (float *) ( ( ( (int)inputSamples ) + 15 ) & ~15 );
float *alignedInputSamples = (float *) ( ( ( (intptr_t)inputSamples ) + 15 ) & ~15 );
//
// allocate and initialize hardware source

View file

@ -374,7 +374,7 @@ void idAudioHardwareOSS::Write( bool flushing ) {
return;
}
// what to write and how much
int pos = (int)m_buffer + ( MIXBUFFER_CHUNKS - m_writeChunks ) * m_channels * 2 * MIXBUFFER_SAMPLES / MIXBUFFER_CHUNKS;
uintptr_t pos = (uintptr_t)m_buffer + ( MIXBUFFER_CHUNKS - m_writeChunks ) * m_channels * 2 * MIXBUFFER_SAMPLES / MIXBUFFER_CHUNKS;
int len = Min( m_writeChunks, m_freeWriteChunks ) * m_channels * 2 * MIXBUFFER_SAMPLES / MIXBUFFER_CHUNKS;
assert( len > 0 );
if ( ( ret = write( m_audio_fd, (void*)pos, len ) ) == -1 ) {

View file

@ -305,7 +305,7 @@ void idAudioHardwareALSA::Write( bool flushing ) {
return;
}
// write the max frames you can in one shot - we need to write it all out in Flush() calls before the next Write() happens
int pos = (int)m_buffer + ( MIXBUFFER_SAMPLES - m_remainingFrames ) * m_channels * 2;
uintptr_t pos = (uintptr_t)m_buffer + ( MIXBUFFER_SAMPLES - m_remainingFrames ) * m_channels * 2;
snd_pcm_sframes_t frames = id_snd_pcm_writei( m_pcm_handle, (void*)pos, m_remainingFrames );
if ( frames < 0 ) {
if ( frames != -EAGAIN ) {

View file

@ -49,7 +49,7 @@ If you have questions concerning this license or the applicable additional terms
#define ALIGN16( x ) __declspec(align(16)) x
#define PACKED
#define _alloca16( x ) ((void *)((((int)_alloca( (x)+15 )) + 15) & ~15))
#define _alloca16( x ) ((void *)((((uintptr_t)_alloca( (x)+15 )) + 15) & ~15))
#define PATHSEPERATOR_STR "\\"
#define PATHSEPERATOR_CHAR '\\'
@ -84,7 +84,7 @@ If you have questions concerning this license or the applicable additional terms
#endif
#define _alloca alloca
#define _alloca16( x ) ((void *)((((int)alloca( (x)+15 )) + 15) & ~15))
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))
#define PATHSEPERATOR_STR "/"
#define PATHSEPERATOR_CHAR '/'
@ -120,7 +120,7 @@ If you have questions concerning this license or the applicable additional terms
#endif
#define _alloca alloca
#define _alloca16( x ) ((void *)((((int)alloca( (x)+15 )) + 15) & ~15))
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))
#define ALIGN16( x ) x
#define PACKED __attribute__((packed))