Bugfix for optimised compilations (at least with g++).

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2241 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2008-09-07 14:39:34 +00:00
parent da69106378
commit de72e53199

View File

@@ -90,10 +90,16 @@ int Message::getInt()
// ----------------------------------------------------------------------------
float Message::getFloat()
{ // ugly...
{
int i = getInt();
float *f = (float*) &i;
return *f;
float f;
memcpy(&f, &i, sizeof(int));
return f;
// The 'obvious' way:
// float *f = (float*) &i;
// return *f;
// does NOT work, see http://www.velocityreviews.com/forums/showthread.php?t=537336
// for details
} // getFloat
// ----------------------------------------------------------------------------