Fix strict aliasing problem.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3988 dfc29bdd-3216-0410-991c-e03cc46cb475
master
hybrid 2011-11-02 23:29:31 +00:00
parent 5ec87d0bd5
commit a4d78dcbe9
1 changed files with 5 additions and 4 deletions

View File

@ -2328,10 +2328,11 @@ f32 CXMeshFileLoader::readFloat()
if (FloatSize == 8)
{
#ifdef __BIG_ENDIAN__
c8 ctmp[8];
*((f32*)(ctmp+4)) = os::Byteswap::byteswap(*(f32 *)P);
*((f32*)(ctmp)) = os::Byteswap::byteswap(*(f32 *)P+4);
const f32 tmp = (f32)(*(f64 *)ctmp);
//TODO: Check if data is properly converted here
f32 ctmp[2];
ctmp[1] = os::Byteswap::byteswap(*(f32*)P);
ctmp[0] = os::Byteswap::byteswap(*(f32*)P+4);
const f32 tmp = (f32)(*(f64*)(void*)ctmp);
#else
const f32 tmp = (f32)(*(f64 *)P);
#endif