diff --git a/neo/d3xp/ai/AAS_routing.cpp b/neo/d3xp/ai/AAS_routing.cpp index acb59ac9..bfad288e 100644 --- a/neo/d3xp/ai/AAS_routing.cpp +++ b/neo/d3xp/ai/AAS_routing.cpp @@ -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 ) ); } /* diff --git a/neo/game/ai/AAS_routing.cpp b/neo/game/ai/AAS_routing.cpp index acb59ac9..eea467fc 100644 --- a/neo/game/ai/AAS_routing.cpp +++ b/neo/game/ai/AAS_routing.cpp @@ -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 ) ); } /* diff --git a/neo/idlib/math/Matrix.cpp b/neo/idlib/math/Matrix.cpp index e6170f35..b0137641 100644 --- a/neo/idlib/math/Matrix.cpp +++ b/neo/idlib/math/Matrix.cpp @@ -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; diff --git a/neo/idlib/math/Matrix.h b/neo/idlib/math/Matrix.h index 44fcdfda..71361f38 100644 --- a/neo/idlib/math/Matrix.h +++ b/neo/idlib/math/Matrix.h @@ -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; diff --git a/neo/idlib/math/Vector.cpp b/neo/idlib/math/Vector.cpp index c29f4b14..552bed22 100644 --- a/neo/idlib/math/Vector.cpp +++ b/neo/idlib/math/Vector.cpp @@ -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; /* diff --git a/neo/idlib/math/Vector.h b/neo/idlib/math/Vector.h index 773bf433..1590188a 100644 --- a/neo/idlib/math/Vector.h +++ b/neo/idlib/math/Vector.h @@ -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; diff --git a/neo/renderer/Cinematic.cpp b/neo/renderer/Cinematic.cpp index 763b4c16..be730d5a 100644 --- a/neo/renderer/Cinematic.cpp +++ b/neo/renderer/Cinematic.cpp @@ -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; diff --git a/neo/renderer/Model_lwo.cpp b/neo/renderer/Model_lwo.cpp index 89bc6c5a..4bb72f7f 100644 --- a/neo/renderer/Model_lwo.cpp +++ b/neo/renderer/Model_lwo.cpp @@ -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 ); diff --git a/neo/sound/snd_system.cpp b/neo/sound/snd_system.cpp index de975d4b..69389ac3 100644 --- a/neo/sound/snd_system.cpp +++ b/neo/sound/snd_system.cpp @@ -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; diff --git a/neo/sound/snd_world.cpp b/neo/sound/snd_world.cpp index cba1e821..72021ff0 100644 --- a/neo/sound/snd_world.cpp +++ b/neo/sound/snd_world.cpp @@ -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 diff --git a/neo/sys/linux/sound.cpp b/neo/sys/linux/sound.cpp index 6ecd8bb4..8873881f 100644 --- a/neo/sys/linux/sound.cpp +++ b/neo/sys/linux/sound.cpp @@ -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 ) { diff --git a/neo/sys/linux/sound_alsa.cpp b/neo/sys/linux/sound_alsa.cpp index b9410512..5513f6ff 100644 --- a/neo/sys/linux/sound_alsa.cpp +++ b/neo/sys/linux/sound_alsa.cpp @@ -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 ) { diff --git a/neo/sys/sys_public.h b/neo/sys/sys_public.h index f31226a8..3df930d4 100644 --- a/neo/sys/sys_public.h +++ b/neo/sys/sys_public.h @@ -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))