From b31e8a67d9b1f11b9943b595a4fd66d3a07dd085 Mon Sep 17 00:00:00 2001 From: ludwig Date: Mon, 3 Nov 2008 17:03:54 +0000 Subject: fix strict aliasing issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Przemysław Iskra (#3805) git-svn-id: svn://svn.icculus.org/quake3/trunk@1481 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/game/g_syscalls.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'code/game/g_syscalls.c') diff --git a/code/game/g_syscalls.c b/code/game/g_syscalls.c index d82be06..59d89bd 100644 --- a/code/game/g_syscalls.c +++ b/code/game/g_syscalls.c @@ -36,9 +36,9 @@ void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) { } int PASSFLOAT( float x ) { - float floatTemp; - floatTemp = x; - return *(int *)&floatTemp; + floatint_t fi; + fi.f = x; + return fi.i; } void trap_Printf( const char *fmt ) { @@ -290,9 +290,9 @@ void trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs } float trap_AAS_Time(void) { - int temp; - temp = syscall( BOTLIB_AAS_TIME ); - return (*(float*)&temp); + floatint_t fi; + fi.i = syscall( BOTLIB_AAS_TIME ); + return fi.f; } int trap_AAS_PointAreaNum(vec3_t point) { @@ -476,15 +476,15 @@ void trap_BotFreeCharacter(int character) { } float trap_Characteristic_Float(int character, int index) { - int temp; - temp = syscall( BOTLIB_AI_CHARACTERISTIC_FLOAT, character, index ); - return (*(float*)&temp); + floatint_t fi; + fi.i = syscall( BOTLIB_AI_CHARACTERISTIC_FLOAT, character, index ); + return fi.f; } float trap_Characteristic_BFloat(int character, int index, float min, float max) { - int temp; - temp = syscall( BOTLIB_AI_CHARACTERISTIC_BFLOAT, character, index, PASSFLOAT(min), PASSFLOAT(max) ); - return (*(float*)&temp); + floatint_t fi; + fi.i = syscall( BOTLIB_AI_CHARACTERISTIC_BFLOAT, character, index, PASSFLOAT(min), PASSFLOAT(max) ); + return fi.f; } int trap_Characteristic_Integer(int character, int index) { @@ -652,9 +652,9 @@ int trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal) { } float trap_BotAvoidGoalTime(int goalstate, int number) { - int temp; - temp = syscall( BOTLIB_AI_AVOID_GOAL_TIME, goalstate, number ); - return (*(float*)&temp); + floatint_t fi; + fi.i = syscall( BOTLIB_AI_AVOID_GOAL_TIME, goalstate, number ); + return fi.f; } void trap_BotSetAvoidGoalTime(int goalstate, int number, float avoidtime) { -- cgit v1.2.3