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:
@@ -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
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user