From ba1adc839f5cdfa67111648077bdf0eb540c327a Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 1 Dec 2011 14:17:32 +0100 Subject: [PATCH] Trivial pointer cast fixes for x86_64 --- d3xp/ai/AAS_routing.cpp | 2 +- game/ai/AAS_routing.cpp | 2 +- idlib/math/Matrix.cpp | 2 +- idlib/math/Matrix.h | 2 +- idlib/math/Vector.cpp | 2 +- idlib/math/Vector.h | 2 +- sys/sys_public.h | 6 +++--- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/d3xp/ai/AAS_routing.cpp b/d3xp/ai/AAS_routing.cpp index acb59ac..bfad288 100644 --- a/d3xp/ai/AAS_routing.cpp +++ b/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/game/ai/AAS_routing.cpp b/game/ai/AAS_routing.cpp index acb59ac..eea467f 100644 --- a/game/ai/AAS_routing.cpp +++ b/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/idlib/math/Matrix.cpp b/idlib/math/Matrix.cpp index e6170f3..b013764 100644 --- a/idlib/math/Matrix.cpp +++ b/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/idlib/math/Matrix.h b/idlib/math/Matrix.h index 44fcdfd..71361f3 100644 --- a/idlib/math/Matrix.h +++ b/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/idlib/math/Vector.cpp b/idlib/math/Vector.cpp index c29f4b1..552bed2 100644 --- a/idlib/math/Vector.cpp +++ b/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/idlib/math/Vector.h b/idlib/math/Vector.h index 773bf43..1590188 100644 --- a/idlib/math/Vector.h +++ b/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/sys/sys_public.h b/sys/sys_public.h index f31226a..3df930d 100644 --- a/sys/sys_public.h +++ b/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))